We help IT Professionals succeed at work.

Open URL in Microsoft Word Macro

AncientFrib
AncientFrib asked
on
Medium Priority
1,461 Views
Last Modified: 2012-05-06
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
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.