Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    472
    Thanks
    43
    Thanked 0 Times in 0 Posts

    Identifying objects in Word to format or delete

    Hi

    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.

    current code:

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

    ActiveDocument.Shapes.SelectAll
    Selection.ShapeRange.Delete

    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

    The commented out code is the new code
    cheers

    Phil Carter

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •