2011-10-03, 20:21 #1
- Join Date
- Feb 2002
- Auckland, New Zealand
- Thanked 0 Times in 0 Posts
Identifying objects in Word to format or delete
We currently have a macro that is run when staff wisgh to finalise reports. The macro removes the company logo, as final is printed on preprinted paper, and removes the draft watermark. However, I am wanting to identify specific graphics in a new document, based on the standard template, that does not delete specific graphics from the final report.
I have tried recording a macro to identify the graphic but can only come up with an object number ("Object 14"). Of course this may vary depending on how the document has been edited.
My question is, can I add a reference to a graphic to allow for specific searching/deleting/not deleting.
' If ActiveDocument.Shapes("Object 14") = True Then
' For Each shp In ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes
' If shp.Type = msoTextEffect Then
' shp.Visible = Not shp.Visible
' End If
' Next shp
For Each shp In ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes
If shp.Type = msoTextEffect Then
shp.Visible = Not shp.Visible
The commented out code is the new codecheers
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2011-10-03, 23:09 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 93 Times in 89 Posts
Hmmm, I thought a Shape (or InlineShape) had a Tag property, but perhaps that is in PowerPoint? There is an AlternateText property you probably could use for your purposes.