Open URL in Microsoft Word Macro

Hello,

I simply want to open a URL in a Microsoft Word macro.  I don't need a browser to open.  In opening this URL I would cause a script to run and I would NOT need to display anything to the user.  Any help is appreciated
LVL 5
AncientFribAsked:
Who is Participating?
 
irudykCommented:
I don't know if this will work, but the following will open up a URL in a web browser that won't be visible and which will close after the web page URL has finished loading.  Maybe give that a try and see if it works on your URL.
Function HyperlinkOpen()
 
Dim objWeb As Object
Set objWeb = CreateObject("InternetExplorer.Application")
objWeb.Navigate "http://www.google.ca"
 
Dim TimeOut As String
TimeOut = Now + TimeValue("00:00:20")  '-- wait maximum of 20 seconds
 
Do While objWeb.Busy Or objWeb.readyState <> 4
    DoEvents
    If Now > TimeOut Then GoTo Done
Loop
 
Done:
objWeb.Quit
Set objWeb = Nothing
 
End Function

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.