PC Review


Reply
Thread Tools Rate Thread

Hyperlink to Run a Macro

 
 
WordWorker
Guest
Posts: n/a
 
      4th Aug 2009
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).



 
Reply With Quote
 
 
 
 
Greg Maxey
Guest
Posts: n/a
 
      4th Aug 2009
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



 
Reply With Quote
 
 
 
 
WordWorker
Guest
Posts: n/a
 
      5th Aug 2009

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

 
Reply With Quote
 
Greg Maxey
Guest
Posts: n/a
 
      5th Aug 2009

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 With Quote
 
WordWorker
Guest
Posts: n/a
 
      5th Aug 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: 1st macro run then 2 macro is run Don Guillett Microsoft Excel Programming 0 16th Feb 2012 01:42 AM
macro will not run with file.xls!macro.macro BillRobPV Microsoft Excel Discussion 2 12th Sep 2008 05:08 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce =?Utf-8?B?bWFyaWthMTk4MQ==?= Microsoft Excel Misc 3 6th May 2005 05:47 AM
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... dollardoc Microsoft Excel Programming 1 7th Apr 2005 12:47 AM
Macro to run or not run a second Macro Darin Kramer Microsoft Excel Programming 2 2nd Dec 2004 05:27 PM


Features
 

Advertising
 

Newsgroups
 


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