MS Word select picture or shape in bookmarked paragraph

  • Dear all


    Just can't get this working..


    I have a code which accesses defined bookmarks in a Word document and deletes tables located in the paragraph of the bookmark (see code example, don't mind that I access Word VBA via excel ).


    Now I would like to expand this code to be able to also find and delete pictures and shapes. After trying out so many different possibilities (Pictures, Shapes, InlineShapes) and failing, this forum seems like my last hope..



    Code
    Dim WDApp As Word.Application
    Dim WDDoc As Word.Document
    
    
        Set WDApp = GetObject(, "Word.Application")
        Set WDDoc = WDApp.ActiveDocument
       
        If WDDoc.Bookmarks("bookmarkname").Range.Tables.Count = 1 Then
           WDDoc.Bookmarks("bookmarkname").Range.Tables(1).Delete
        End If



    Thanks in advance for any help!


    Dave

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!