コマンドボタンをクリックすると、Yahooなどのホームページを開くようにしたいのですが、できるのでしょうか?
ご教授よろしくお願いします。
簡単な例ですが…
・form1、command1をつくる。
・↓これをはる
Option Explicit
'ブラウザでURLを開くためのAPI宣言
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hWnd As Long, _
ByVal lpVerb As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Const strMyHomepage As String = "http://www.yahoo.co.jp/"
Private Sub Command1_Click()
Dim lngReturn As Long
lngReturn = ShellExecute(Me.hWnd, _
"open", strMyHomepage, vbNullChar, vbNullChar, 1)
End Sub
もっといい方法があるかもしれませんが、ご参考まで。
ありがとうございました。
編集 削除