Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Thanks to Dave and Tom

Thank you, gentlemen. That's just what I needed.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Hyperlink result as working hyperlink Bod Excel Worksheet Functions 2 January 22nd 10 04:22 AM
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM


All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"