Launch an excel hyperlink programatically without clicking

  • Thread starter Thread starter excel
  • Start date Start date
E

excel

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,
 
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top