Consulting

Results 1 to 10 of 10

Thread: [VBA]Delete page with given text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [VBA]Delete table/page with given text

    Hello everyone!

    Will someone be kind and help me with a VBA code, I am new into this and want to learn.
    Is there a way to delete a Microsoft Word Document table/page by giving a specific keyword by creating a VBA in Excel? I am asking this because I am working in a Music Store and we have to get rid of some table/page in Multiple Word Documents, and I guess it would be easier by a VBA in Excel (by searching for a given text and delete), rather than copy pasting the VBA in each Word.

    I found this on SOF https://stackoverflow.com/questions/...-specific-text
    but seems to work only in Word VBA.

    Can someone help? Thank you in advance

    Below is what I've tried so far, but unfortunately it doesen't do anything after searching the word "Solo", so that's wrong and it is not what I want. Perhaps what my code is missing is to jump (goTo) to the table once the text was found then to delete as below


          With .Find                
                    .Forward = False
                    .ClearFormatting
                    .MatchWholeWord = True
                    .MatchCase = True
                    .Wrap = wdFindContinue
                    .Text = "Solo"
                    .Execute
                     If .Execute = True Then
                     Table.delete
                    End If
                End With
    Best,
    John
    Last edited by johngalvin; 09-20-2019 at 08:55 AM.

Tags for this Thread

Posting Permissions

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