Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 01-28-2015, 04:41 PM
macropod's Avatar
macropod macropod is offline Assign Macro to Shape in Word 2013 Windows 7 64bit Assign Macro to Shape in Word 2013 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
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

A Document_ContentControlOnEntry macro might be coded as:
Code:
Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
With ContentControl
  If .Title = "MyPic" Then
    With .Range.InlineShapes(1)
      If .Width > CentimetersToPoints(1) Then
        .Width = CentimetersToPoints(1)
      Else
        .Width = CentimetersToPoints(4)
      End If
    End With
  End If
End With
End Sub
and assumes your picture content control's Title = "MyPic". The code would be added to the document's 'ThisDocument' code module. The above is a trivial demo that just changes the image's width back & forth from 1 to 4 cm.

I don't agree that "Word makes assigning and using macros so much harder than Excel". It's not harder, just different in some respects.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign Macro to Shape in Word 2013 How to assign a key shortcut to a particular shape in word? Retko Word 5 08-23-2014 09:04 PM
Assign keyboard short cut to macro AndyDDUK PowerPoint 1 01-09-2013 09:28 AM
Assign Macro to Shape in Word 2013 Assign macro but hide the button/field trlear Word VBA 5 02-23-2012 04:35 PM
Run Macro & Activate shape ibrahimaa Excel Programming 1 01-21-2012 02:14 AM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:18 PM.


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