How do delete an specific page in a word document using Excel VBA

0 votes

When this code is executed, no error notice is returned, but the word page content is not removed as intended. What am I overlooking?

With wDoc
    .GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Name:="20" 'Page number
    .Bookmarks("\Page").Select
    With Selection
      .Delete
    End With
End With

I'd like to remove a certain page from the word document I've created and filled up using Excel VBA. I deleted using the following method:

Nov 21 in Others by Kithuzzz
• 20,660 points
24 views

1 answer to this question.

0 votes

Check the code below. I eliminated the quotation marks from this name parameter (replaced "20" with 20) Instead of the Activedocument that I have used, you can use the wDoc document reference.

With ActiveDocument
    .GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Name:=20 'Page number
    .Bookmarks("\Page").Select
    With Selection
      .Delete
    End With
End With

I hope this helps you.

answered Nov 21 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

How do I insert a WebP-image (".jpg") in Excel using VBA?

It's not currently on the list of ...READ MORE

answered Nov 15 in Others by narikkadan
• 37,660 points
37 views
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24 in Others by narikkadan
• 37,660 points
119 views
0 votes
1 answer

How can I find and replace text in Word using Excel VBA?

Try this code Option Explicit Const wdReplaceAll = 2 Sub ...READ MORE

answered Oct 15 in Others by narikkadan
• 37,660 points
100 views
0 votes
1 answer
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,720 points
451 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,218 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9 in Others by gaurav
• 22,040 points
69 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16 in Others by Edureka
• 13,640 points
205 views
0 votes
1 answer
0 votes
1 answer

How to stick an embedded document in a specific cell of an excel

Solution Select the documents (you can use the ...READ MORE

answered Oct 18 in Others by narikkadan
• 37,660 points
33 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP