Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2016, 01:46 PM
brucemc777 brucemc777 is offline How do I trigger a macro from a document? Windows 7 64bit How do I trigger a macro from a document? Office 2016
Advanced Beginner
How do I trigger a macro from a document?
 
Join Date: Jul 2014
Location: Fredericksburg, VA
Posts: 41
brucemc777 is on a distinguished road
Default How do I trigger a macro from a document?

In Excel I can simply insert a shape and have it trigger a macro when the shape is clicked. Tried that in Word and I thought I was going blind as I found no such option to attach a macro to a shape, at least not in a template. Is there another means that is used by normal convention?
Reply With Quote
  #2  
Old 01-23-2016, 02:20 PM
macropod's Avatar
macropod macropod is offline How do I trigger a macro from a document? Windows 7 64bit How do I trigger a macro from a document? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could put the Shape into a Rich Text content control and use a Content_Control onEntry to trigger the macro or you could use use Word's Selection_Change event. See:
https://msdn.microsoft.com/en-us/lib...or=-2147217396
http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-23-2016, 02:39 PM
brucemc777 brucemc777 is offline How do I trigger a macro from a document? Windows 7 64bit How do I trigger a macro from a document? Office 2016
Advanced Beginner
How do I trigger a macro from a document?
 
Join Date: Jul 2014
Location: Fredericksburg, VA
Posts: 41
brucemc777 is on a distinguished road
Default

Once again, rescuing me - very much appreciated!

Got to wonder why they don't allow tying macros to shapes with Word but they do in Excel...
Reply With Quote
  #4  
Old 01-25-2016, 01:21 AM
Guessed's Avatar
Guessed Guessed is offline How do I trigger a macro from a document? Windows 10 How do I trigger a macro from a document? Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You can also insert a macrobutton field to run a macro on double click eg
{Macrobutton MyMacro "Double click to run the MyMacro macro"}
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 01-25-2016, 01:42 AM
macropod's Avatar
macropod macropod is offline How do I trigger a macro from a document? Windows 7 64bit How do I trigger a macro from a document? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Andrew,

The problem with that is that is that it doesn't work with Shapes - only with InlineShapes - and, if you use, say an Oval autoshape as the InlineShape, all Word displays is a grey panel where the field is. Conversely, if you use the docm format with a graphical object, double clicking on the field activates the Picture Tools contextual tab instead of the macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
macro, shap

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I trigger a macro from a document? Autocorrect trigger problem kcvinu Word 1 07-03-2015 10:41 PM
How to trigger a html link using rules. kitcha321 Outlook 1 06-15-2015 09:17 PM
How do I trigger a macro from a document? How Find Out What Keys Trigger My Macros? peytontodd Word 1 10-28-2013 09:39 AM
Hyperlink in cell to trigger pop up text box Carpie Excel Programming 0 08-13-2013 10:33 AM
Desperatly need help in trigger animations quinn307 PowerPoint 0 03-27-2011 08:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft