Hello, I use the following code in Word VBA for firing up the default browser and opening the Google web site: Dim objshell As Object Set objshell = CreateObject("Shell.Application") objshell.Open "http://www.google.com" However, if the default browser is already running, the above VBA code will open the Google web page by *replacing* the "last active web page" (i.e. the web page that I last visited). How should I modify the code so that the Google web page will open in a new web page instead? Suggestions are most welcome!
Hi Robot, maybe: Sub Test2() ' Dim var Dim s As String s = "C:\Program Files\Internet Explorer\iexplore.exe" s = Chr(34) & s & Chr(34) s = s & "http://www.google.com" Shell s ' or ' var = Shell(s) End Sub -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP
Hi Helmut, Your code works, thank you so much!
robot wrote: > Hi Helmut, > > Your code works, thank you so much! No, don't use that! It's highly fragile, and of course won't be at all to the user's pleasure if they use Firefox or Opera or something else as the default browser. Here's the simple way to load a page in whatever browser the user prefers: http://vb.mvps.org/samples/HyperJmp -- .NET: It's About Trust! http://vfred.mvps.org
Karl, Thank you so much for your help. Even though I use the Shell function without a problem, I can see that your code is more advanced and more flexible, so I tried it out and find it to work very well . Thanks again.