PDA

View Full Version : FollowHyperlink and NewWindow:=False



jmrdaddy
11-07-2005, 11:27 AM
I've tried the line of code below. I can't get the option "NewWindow:=False" to work. A new window is opened every time regardless of whether the value is "True" or "False". Is there on option in IE that preempts this? Has anyone else encountered this before? What did you do?


ActiveDocument.FollowHyperlink Address:="http://www.microsoft.com (http://www.microsoft.com/)", NewWindow:=False, AddHistory:=True

fumei
11-07-2005, 08:28 PM
Please use the underscore character when you post code. It makes it much easier for the rest of us. You too! Your code would look something like:
ActiveDocument.FollowHyperlink _
Address:="http://www.microsoft.com", _
NewWindow:=False, AddHistory:=True
See, it makes the code window smaller, and we don't have to scroll left and right, as well as up and down.

Also please post your Word version.

It helps if you tell us what you want to achieve. Is it simply to NOT open the link in a new window? It would also help if you state if you have an instance of IE already loaded. Are you loading IE as some other part of your code?

jmrdaddy
11-07-2005, 09:31 PM
ok
i'm running this like it is right out of the microsoft help files.
there is an instance (even several instances) of IE running.
i want to run this code or something like it and reuse the same IE window but it keeps opening a new window every time no matter what the value of NewWindow happens to be. the code doesn't open an IE window anywhere else.

Killian
07-21-2006, 04:16 AM
Doesn't seem to working for me either.
Maybe you could just manage your own instance of IE and use that directly'module level declaration
Dim ie As Object

Sub GoToURL(str As String)

CheckForIEInstance
ie.Navigate URL:=str

End Sub

Sub CheckForIEInstance()

If ie Is Nothing Then
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
End If

End Sub

'#########################################################
'usage
Sub CommandButton1_Click()
GoToURL "http://www.microsoft.com"
End Sub

Sub CommandButton2_Click()
GoToURL "http://www.vbaexpress.com"
End Sub

fumei
07-22-2006, 01:41 PM
I have never got NewWindow to work properly.

mdmackillop
07-23-2006, 07:24 AM
There are some references to using hyperlinks with NewWindow in Access at the MS website. Basically, it just doesnt work.

Killian
07-25-2006, 05:02 AM
Basically, it just doesnt work.We seem to be building a consensus here.

It occured to be that it might have been broken by a security update.
It also occured to me that Word can't possibly know which existing browser instance to use unless it created it..?!

fumei
07-25-2006, 06:48 AM
Perhaps, but it is not really a question of which...just don't make a new one. In other words, hey Word...do you mind seeing if there IS an instance of IE (which should be too much of a strain on Word), and if there is, use THIS address in it...but DON'T make a new window.

You may very well be right about a security update though.

rps1
10-23-2006, 11:22 AM
Checking in to see if anyone figured out how to keep new windows from appearing despite the 'False' value for NewWindow. I am using Access 97, but have the same issue. I was hoping that (Application.FollowHyperlink) would return some App ID that could be used to terminate the new window.

fumei
10-23-2006, 10:27 PM
Nope...it doesn't work as it is "supposed to". Like I said, I have never been able to get NewWindow to work as False.