View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default ThisWorkbook.FollowHyperlink to Location in Workbook

Sorry - didn't realize you were moving in the same workbook.

I am sure Dick's example works, but why use a hyperlink. Why not use

Sub AA()
Application.GoTo Reference:=Worksheets("Sheet2").Range("B3"), _
Scroll:=True
End Sub


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Sub AA()
ActiveWorkbook.FollowHyperlink _
Address:="C:\Data\Add_Button.xls", _
SubAddress:="Sheet2!B3"
End Sub

worked fine for me.

--
Regards,
Tom Ogilvy

"James Cox" wrote in message
...
Doug -

Well, that adds a hyperlink to the workbook at the location of the

current
cell - which I need to avoid because it could overwrite whatever was in

the
current cell when the macro runs.

Also, it doesn't go to the hyperlink target - just creates the hyperlink

and
stays there.

Thanks for the help, but that's not the functionality needed....

James



"Doug Glancy" wrote in message
...
James,

Running the macro recorder, I get this, which adds the Anchor

parameter
to
what you've got. Does that help?

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",

SubAddress:=
_
"Sheet2!A1", TextToDisplay:="Sheet2!A1"

Doug

"James Cox" wrote in message
...
I can get the following to work in a VBA sub:

ThisWorkbook.FollowHyperlink

Address:="http://example.microsoft.com"

but get an error when I try to specify a location in the workbook

with:

ThisWorkbook.FollowHyperlink Address:="",

SubAddress:="Sheet1!A3"

It seemed that would be the proper format for the address in the

open
workbook, but I'm picking up an error - "Run time error 5 - Invalid
procedure call or argument"

What am I missing or doing wrong here? I really need to do this
programatically and not have to define a "fixed" hyperlink on the
worksheet
(or anywhere else).

Thanks in advance for any help you can give!

James