[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VBA for Microsoft Word:  Opening a URL

Posted on 2006-11-16
3
Medium Priority
?
614 Views
Last Modified: 2008-02-26
Hi - could someone please advise how to open a URL from VBA within Word.

I can re-focus on an open Internet Explorer using AppActivate, but I want to open a fresh instance of Internet Explorer and navigate to a specific URL without any interaction by the user, ie: no hyperlink to click on or button to press etc.

Also, will the code someone lists work with both IE6 and the new IE7 or more specifically, Microsoft Internet Explorer and Windows Internet Explorer.

Many thanks.

Justin.
0
Comment
Question by:justinkent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 17954700
Greetings, justinkent.

The code below will create a new instance of Internet Explorer, navigate to the URL given, and then make the browser visible.  This works fine in IE6, not sure about IE7 as I don't have it loaded, but I'm pretty confident this'll work.  

Sub OpenIE()
    Const READYSTATE_COMPLETE = 4
    Dim objIE As Object
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Navigate2 "http://www.yahoo.com"
    Do While objIE.readyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
    objIE.Visible = True
    Set objIE = Nothing
End Sub

Cheers!
0
 

Author Comment

by:justinkent
ID: 17957094
Perfect, thanks.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17967290
You're welcome.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question