Web Link in Menu

J

jmorley

Please help with the VBA code for opening the default
browser and pointing to a specific Web site, from within
Microsoft Word.

This is an entry I would like to place on a Microsoft Word
menu.

Any help will be appreciated.
 
L

Larry

Here is code that will open Internet Explorer, then open the named
website:

Shell ("C:\Program Files\Internet Explorer\IEXPLORE.EXE
www.washingtonpost.com"), vbNormalFocus

Alter this code according to the path of the default browser in your
system and the desired web address. There are also several options for
the way IE opens, which you can access by typing a comma after the close
parentheses following the web address. Then just use the Customize
dialog box to drag the macro the menu you want.

Larry
 
L

Lars-Eric Gisslén

jmorley,

The following code will open a web page in the default browser.

'--------------------------------
Private Declare Function ShellExec Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal pOperation As String, _
ByVal pFile As String, _
ByVal pParam As String, _
ByVal pDir As String, _
ByVal nShow As Long) As Long

Sub OpenWeb()
Dim nResult As Long

nResult = ShellExec(0, "Open", "HTTP://www.microsoft.com", "", "", 0)

If nResult <= 32 Then
MsgBox "Sorry, could not start you Browser"
End If
End Sub
'----------------------------------

Regards,
Lars-Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top