ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Launch an excel hyperlink programatically without clicking (https://www.excelbanter.com/excel-programming/385077-launch-excel-hyperlink-programatically-without-clicking.html)

[email protected]

Launch an excel hyperlink programatically without clicking
 
In C6, I have the following: =HYPERLINK(D5,"Folder on PC").
In D5, I have =PCPath.
PCPath is a rangename that refers to somewhere on my PC depending on
the value of another cell.

My question: Can I make a macro that launches this hyperlink without
having to pick up the mouse (e.g. ctrl-A)?
Thanks,


Gary''s Student

Launch an excel hyperlink programatically without clicking
 
Range("C5").Select
and then simulate a mouse click. See:

http://scriptorium.serve-it.nl/view.php?sid=44
--
Gary's Student
gsnu200710


" wrote:

In C6, I have the following: =HYPERLINK(D5,"Folder on PC").
In D5, I have =PCPath.
PCPath is a rangename that refers to somewhere on my PC depending on
the value of another cell.

My question: Can I make a macro that launches this hyperlink without
having to pick up the mouse (e.g. ctrl-A)?
Thanks,



[email protected]

Launch an excel hyperlink programatically without clicking
 
The macro breaks in between these two lines:
Public Const SW_SHOW = 5

Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd
As Long) As Long

and gives the following message in a pop up visual basic window:
"Compile Error: Only comments may appear after End Sub, End function,
or End Property."

Any ideas?



NickHK

Launch an excel hyperlink programatically without clicking
 
These statements need to go at the top of the module, in the Declarations
section.
Also, depending on the type of code module, you may have to make them
Private.

NickHK

wrote in message
oups.com...
The macro breaks in between these two lines:
Public Const SW_SHOW = 5

Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd
As Long) As Long

and gives the following message in a pop up visual basic window:
"Compile Error: Only comments may appear after End Sub, End function,
or End Property."

Any ideas?






All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com