回答編集履歴
1
コード追記
test
CHANGED
@@ -47,3 +47,105 @@
|
|
47
47
|
はまったく別の機能ですので一つに纏める必然性はないです。
|
48
48
|
|
49
49
|
「セル内容をコピーする」は同じ機能のボタンが多数あるのでクラス化するのは意味がありますか、他の2つはクラスにする必然性はないです。
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
クラスを使わない場合のコード例
|
54
|
+
|
55
|
+
---
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```vba
|
60
|
+
|
61
|
+
Option Explicit
|
62
|
+
|
63
|
+
Dim WithEvents IELbtn As CommandButton
|
64
|
+
|
65
|
+
Dim WithEvents CHLbtn As CommandButton
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
Private Sub IELbtn_Click()
|
70
|
+
|
71
|
+
Dim ie As InternetExplorer
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
MsgBox "IEでインターネットへ接続します。"
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
Set ie = CreateObject("InternetExplorer.Application")
|
80
|
+
|
81
|
+
ie.Navigate Cells(ActiveCell.Row, 5)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
ie.Visible = True
|
86
|
+
|
87
|
+
End Sub
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
Private Sub CHLbtn_Click()
|
92
|
+
|
93
|
+
Dim Ch As Variant
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
MsgBox "Chromeでインターネットへ接続します。"
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
Set Ch = CreateObject("WScript.Shell")
|
102
|
+
|
103
|
+
Ch.Run "chrome.exe -url " & Cells(ActiveCell.Row, 5)
|
104
|
+
|
105
|
+
Set Ch = Nothing
|
106
|
+
|
107
|
+
End Sub
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
Private Sub UserForm_Initialize()
|
112
|
+
|
113
|
+
Set IELbtn = Me.Controls.Add("Forms.CommandButton.1", "IEL", True)
|
114
|
+
|
115
|
+
Set CHLbtn = Me.Controls.Add("Forms.CommandButton.1", "CHL", True)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
With IELbtn
|
120
|
+
|
121
|
+
.Top = 64
|
122
|
+
|
123
|
+
.Left = 10
|
124
|
+
|
125
|
+
.Height = 20
|
126
|
+
|
127
|
+
.Width = 100
|
128
|
+
|
129
|
+
.Caption = "IEでアクセス"
|
130
|
+
|
131
|
+
End With
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
With CHLbtn
|
136
|
+
|
137
|
+
.Top = 64
|
138
|
+
|
139
|
+
.Left = 120
|
140
|
+
|
141
|
+
.Height = 20
|
142
|
+
|
143
|
+
.Width = 100
|
144
|
+
|
145
|
+
.Caption = "Chromeでアクセス"
|
146
|
+
|
147
|
+
End With
|
148
|
+
|
149
|
+
End Sub
|
150
|
+
|
151
|
+
```
|