回答編集履歴
1
コード修正
test
CHANGED
@@ -57,3 +57,47 @@
|
|
57
57
|
End Select
|
58
58
|
|
59
59
|
```
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
よく見たら、上記のコード、なんか遠回りのことをしてますね。
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```vba
|
68
|
+
|
69
|
+
Dim ws As Worksheet
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
On Error Resume Next 'エラー無視
|
74
|
+
|
75
|
+
Set ws = Worksheets("レポート")
|
76
|
+
|
77
|
+
On Error GoTo 0 'エラー無視解除
|
78
|
+
|
79
|
+
If ws Is Nothing Then '"レポート"シートが存在しなければ、
|
80
|
+
|
81
|
+
Worksheets(Array("表紙", "検索", "表示箇所", "行動", "順位")).Select
|
82
|
+
|
83
|
+
ActiveSheet.ExportAsFixedFormat _
|
84
|
+
|
85
|
+
Type:=xlTypePDF, _
|
86
|
+
|
87
|
+
Filename:=ExcelFilePath & ExFileName, _
|
88
|
+
|
89
|
+
OpenAfterPublish:=True
|
90
|
+
|
91
|
+
Else
|
92
|
+
|
93
|
+
ws.ExportAsFixedFormat _
|
94
|
+
|
95
|
+
Type:=xlTypePDF, _
|
96
|
+
|
97
|
+
Filename:=ExcelFilePath & ExFileName, _
|
98
|
+
|
99
|
+
OpenAfterPublish:=True
|
100
|
+
|
101
|
+
End If
|
102
|
+
|
103
|
+
```
|