Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
WordWorker WordWorker is offline
external usenet poster
 
Posts: 16
Default Hyperlink to Run a Macro

Is it possible to have a hyperlink run a macro?

If yes, how?

If no, suggest this capability be added to the next version of Word (and
Access, Excel, PowerPoint, et al).



  #2   Report Post  
WordBanter AI WordBanter AI is offline
Word Super Guru
 
Posts: 1,200
Thumbs up Answer: Hyperlink to Run a Macro

Yes, it is possible to have a hyperlink run a macro in Microsoft Word. Here are the steps to do it:
  1. Open the Word document where you want to add the hyperlink.
  2. Select the text or image that you want to turn into a hyperlink.
  3. Right-click on the selected text or image and choose "Hyperlink" from the context menu.
  4. In the "Insert Hyperlink" dialog box, select "Place in This Document" on the left-hand side.
  5. Choose the macro that you want to run from the list of available macros on the right-hand side.
  6. Click "OK" to close the dialog box and create the hyperlink.

Now, when you click on the hyperlink, it will run the selected macro.

If you don't see the macro you want to run in the list of available macros, you may need to create it first. Here are the steps to create a macro in Word:
  1. Click on the "View" tab in the ribbon.
  2. Click on "Macros" in the "Macros" group.
  3. In the "Macros" dialog box, enter a name for your macro in the "Macro name" field.
  4. Click "Create" to open the Visual Basic Editor.
  5. Write the code for your macro in the editor.
  6. Save and close the editor.
  7. Close the "Macros" dialog box.

Now your macro should be available in the list of available macros when you create a hyperlink.

As for suggesting this capability be added to other Microsoft Office applications, you can submit feedback directly to Microsoft through their website or through the "Feedback" button in the application. They are always looking for ways to improve their products, so your suggestion may be considered for future updates.
__________________
I am not human. I am a Microsoft Word Wizard
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default Hyperlink to Run a Macro

AFAIK, no.

Have you cosidered a macrobutton field?

{MarcoButton ThisMacro "Click to run this macro"}

The field braces are entered using CTL+F9

ThisMacro is the name of the macro in the current project that you want to
run.

Toggle the field code and double click to run.



WordWorker wrote:
Is it possible to have a hyperlink run a macro?

If yes, how?

If no, suggest this capability be added to the next version of Word
(and Access, Excel, PowerPoint, et al).


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
WordWorker WordWorker is offline
external usenet poster
 
Posts: 16
Default Hyperlink to Run a Macro

Greg,

I don't quite understand. (I'm not a macro or VBA programmer; I just sort
of stumble around with mostly macros by example and some simple
manipulations.)

Without giving a whole macro course, can you expand a bit on how to do what
you are talking about and how it works? Will it work in Word 2007? Will it
work in a locked doc?

WordWorker


"Greg Maxey" wrote:

AFAIK, no.

Have you cosidered a macrobutton field?

{MarcoButton ThisMacro "Click to run this macro"}

The field braces are entered using CTL+F9

ThisMacro is the name of the macro in the current project that you want to
run.

Toggle the field code and double click to run.



WordWorker wrote:
Is it possible to have a hyperlink run a macro?

If yes, how?

If no, suggest this capability be added to the next version of Word
(and Access, Excel, PowerPoint, et al).


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default Hyperlink to Run a Macro

WordWorker,

I have had no formal training myself so my use of technical terms may be a
little offbase.

A macro is a procedure stored in document project (either the ThisDocument
object or separate module)

Open the document. Open the VB Editor (VBE) using Alt+F11. If not
displayed, display the Project Explorer pane (CTRL+R).

In the explore pane click to expand the project. Insert the following code
in the "ThisDocument" object:

Sub ExampleMacro()
MsgBox "The example macro just executed"
End Sub

Close the editor.

In the document place the cursor where the link should appear and press
CTRL+F9

In the field braces that appear { } type in MacroButton ExampleMacro "Dbl
click to run macro"

Right click the field and toggle field codes.

Yes it works in Word2007 and yes it works in protected forms.



WordWorker wrote:
Greg,

I don't quite understand. (I'm not a macro or VBA programmer; I just
sort of stumble around with mostly macros by example and some simple
manipulations.)

Without giving a whole macro course, can you expand a bit on how to
do what you are talking about and how it works? Will it work in Word
2007? Will it work in a locked doc?

WordWorker


"Greg Maxey" wrote:

AFAIK, no.

Have you cosidered a macrobutton field?

{MarcoButton ThisMacro "Click to run this macro"}

The field braces are entered using CTL+F9

ThisMacro is the name of the macro in the current project that you
want to run.

Toggle the field code and double click to run.



WordWorker wrote:
Is it possible to have a hyperlink run a macro?

If yes, how?

If no, suggest this capability be added to the next version of Word
(and Access, Excel, PowerPoint, et al).


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
WordWorker WordWorker is offline
external usenet poster
 
Posts: 16
Default Hyperlink to Run a Macro

It Works! You may have just solved a major problem I am having with a locked
document. It was the "toggle field" that threw the whole thing off for me
because I didn't know about it. I turned field codes off differently, but
your way is much handier. Thank you so very much, Greg.

"Greg Maxey" wrote:

WordWorker,

I have had no formal training myself so my use of technical terms may be a
little offbase.

A macro is a procedure stored in document project (either the ThisDocument
object or separate module)

Open the document. Open the VB Editor (VBE) using Alt+F11. If not
displayed, display the Project Explorer pane (CTRL+R).

In the explore pane click to expand the project. Insert the following code
in the "ThisDocument" object:

Sub ExampleMacro()
MsgBox "The example macro just executed"
End Sub

Close the editor.

In the document place the cursor where the link should appear and press
CTRL+F9

In the field braces that appear { } type in MacroButton ExampleMacro "Dbl
click to run macro"

Right click the field and toggle field codes.

Yes it works in Word2007 and yes it works in protected forms.



WordWorker wrote:
Greg,

I don't quite understand. (I'm not a macro or VBA programmer; I just
sort of stumble around with mostly macros by example and some simple
manipulations.)

Without giving a whole macro course, can you expand a bit on how to
do what you are talking about and how it works? Will it work in Word
2007? Will it work in a locked doc?

WordWorker


"Greg Maxey" wrote:

AFAIK, no.

Have you cosidered a macrobutton field?

{MarcoButton ThisMacro "Click to run this macro"}

The field braces are entered using CTL+F9

ThisMacro is the name of the macro in the current project that you
want to run.

Toggle the field code and double click to run.



WordWorker wrote:
Is it possible to have a hyperlink run a macro?

If yes, how?

If no, suggest this capability be added to the next version of Word
(and Access, Excel, PowerPoint, et al).

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to schedule a macro with a hyperlink LIMS Microsoft Word Help 1 November 28th 06 10:37 PM
Where's the Hyperlink Macro?? Bracinowski Microsoft Word Help 1 August 23rd 06 01:17 PM
how can i assign a macro to a hyperlink? ku2k4 Microsoft Word Help 1 July 20th 06 03:26 PM
hyperlink in a macro bold17 Microsoft Word Help 4 August 9th 05 02:17 AM
hyperlink in a macro bold17 Microsoft Word Help 0 August 5th 05 06:10 PM


All times are GMT +1. The time now is 03:23 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"