ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   running a VBA sub from a hyperlink (https://www.excelbanter.com/excel-programming/282606-running-vba-sub-hyperlink.html)

Paul James[_3_]

running a VBA sub from a hyperlink
 
Is there any way to get a hyperlink to run a VBA sub procedure when you
click on the hyperlink?

Thanks in advance.

Paul



Tom Ogilvy

running a VBA sub from a hyperlink
 
Use the follow hyperlink event to run the code.

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Is there any way to get a hyperlink to run a VBA sub procedure when you
click on the hyperlink?

Thanks in advance.

Paul





Paul James[_3_]

running a VBA sub from a hyperlink
 
Thanks for the info, Tom.

Question: could you please say a few words about how to use a follow
hyperlink event?

I know how to create a Sub Procedure in the VBE, and I know how to assign
the procedure to a command button. But how do you "follow" a "hyperlink
event?"

Thanks again in advance.

Paul



"Tom Ogilvy" wrote in message
...
Use the follow hyperlink event to run the code.

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Is there any way to get a hyperlink to run a VBA sub procedure when you
click on the hyperlink?

Thanks in advance.

Paul







Dave Peterson[_3_]

running a VBA sub from a hyperlink
 
Take a look at FollowHyperlink Method in VBA's help.

It has a nice example.



Paul James wrote:

Thanks for the info, Tom.

Question: could you please say a few words about how to use a follow
hyperlink event?

I know how to create a Sub Procedure in the VBE, and I know how to assign
the procedure to a command button. But how do you "follow" a "hyperlink
event?"

Thanks again in advance.

Paul

"Tom Ogilvy" wrote in message
...
Use the follow hyperlink event to run the code.

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Is there any way to get a hyperlink to run a VBA sub procedure when you
click on the hyperlink?

Thanks in advance.

Paul





--

Dave Peterson


Tom Ogilvy

running a VBA sub from a hyperlink
 
The followhyperlink method is availabel in xl2000 and later.

right click on the sheet tab and select view code
At the top of the module,
in the left dropdown, select WorkSheet
In the righ dropdown select followhyperlink

Private Sub FollowHyperLink(byVal Target as hyperlink)

if hyperlink.Address = "yourhyperlinkaddress" then
call MyMacro
End if
End Sub



Paul James wrote in message
...
Thanks for the info, Tom.

Question: could you please say a few words about how to use a follow
hyperlink event?

I know how to create a Sub Procedure in the VBE, and I know how to assign
the procedure to a command button. But how do you "follow" a "hyperlink
event?"

Thanks again in advance.

Paul



"Tom Ogilvy" wrote in message
...
Use the follow hyperlink event to run the code.

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Is there any way to get a hyperlink to run a VBA sub procedure when

you
click on the hyperlink?

Thanks in advance.

Paul









Paul James[_4_]

Thanks to Dave and Tom
 
Thank you, gentlemen. That's just what I needed.



Tom Ogilvy

running a VBA sub from a hyperlink
 
That should have said,
The followhyperlink Event is available in xl2000 and later.

sorry about that.

--
Regards,
Tom Ogilvy

Tom Ogilvy wrote in message
...
The followhyperlink method is availabel in xl2000 and later.

right click on the sheet tab and select view code
At the top of the module,
in the left dropdown, select WorkSheet
In the righ dropdown select followhyperlink

Private Sub FollowHyperLink(byVal Target as hyperlink)

if hyperlink.Address = "yourhyperlinkaddress" then
call MyMacro
End if
End Sub



Paul James wrote in message
...
Thanks for the info, Tom.

Question: could you please say a few words about how to use a follow
hyperlink event?

I know how to create a Sub Procedure in the VBE, and I know how to

assign
the procedure to a command button. But how do you "follow" a "hyperlink
event?"

Thanks again in advance.

Paul



"Tom Ogilvy" wrote in message
...
Use the follow hyperlink event to run the code.

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Is there any way to get a hyperlink to run a VBA sub procedure when

you
click on the hyperlink?

Thanks in advance.

Paul












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

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