VBA & Macro Problems

How to Delete the First Page in Word Documents Using VBA

Muhammad TalhaMuhammad Talha Oct 26, 2026 868 views

Question details

The user needs a reliable method to automatically remove the first page from multiple Word documents after they are completed.

How to Delete the First Page from Word Documents with VBA
Product
Word
Device & OS
not provided
Scenario
Processing hundreds of restricted Word templates and needing to remove their unnumbered first pages systematically.
Observed behavior
The user wants to transition from manually deleting the first page to automating the deletion process using a VBA macro without breaking document protection.
Before you start

Before running this VBA script, confirm whether your templates have editing restrictions enabled. You will need to temporarily remove document protection, otherwise the macro will return a run-time error when attempting to delete the page.

Solution 1Recommended

Use a VBA Macro to Delete the First Page

This is the most direct and efficient method to automate the deletion of the very first page in any standard Word document.

The script works by forcing the cursor to the absolute beginning of the document and then invoking Word's built-in hidden bookmark for the current page to select and delete its contents.

1
Open the VBA Editor

Open your Word document and press Alt + F11 on your keyboard to launch the Microsoft Visual Basic for Applications window.

2
Insert a New Module

Click on 'Insert' in the top menu bar, then select 'Module' from the dropdown list to create a blank workspace for your code.

3
Paste the Macro Code

Copy and paste the following VBA code into the module window: Sub DeleteVeryFirstPageOfDoc() On Error GoTo ErrorHandler Selection.HomeKey Unit:=wdStory Selection.Bookmarks("\page").Range.Delete Exit Sub ErrorHandler: End Sub

4
Run the Macro

Press F5 or click the green 'Run' button in the toolbar. The macro will immediately select and delete the entire first page of your active document.

Use a VBA Macro to Delete the First Page
Macro Testing: Always test the macro on a sample copy of your template first to ensure that it correctly handles your specific page breaks and numbering.
Powerful Document Editor

Edit Word Documents and Run VBA Macros in WPS Office

WPS Office Writer offers robust compatibility with Microsoft Word, including full support for VBA macros in its advanced versions. You can easily write, test, and run your VBA codes to automate document tasks while enjoying a lightweight and user-friendly interface.

  1. 1. Open Your Document: Launch WPS Writer and open your Word template (.docm or .docx) that requires editing.
  2. 2. Access Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click the 'Visual Basic' icon to open the VBA editor.
  3. 3. Insert the Macro: Go to Insert > Module, and paste your first-page deletion VBA script into the code window.
  4. 4. Run the Code: Click 'Run' to execute the macro, which will instantly remove the first page in your WPS Writer environment.
Seamlessly opens, edits, and saves .docx, .doc, and .docm formats.Fully supports VBA macros for advanced document automation and formatting.Lightweight software with a highly familiar user interface.Provides a completely free basic version with optional premium features.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a Run-time error when executing this macro?

This usually happens if the document has editing restrictions or protection enabled. The macro cannot alter protected content. You must temporarily remove document protection before running the macro, then reapply it afterward.

Will deleting the first page mess up my page numbering?

If your first page is unnumbered and the second page starts at 'Page 1' using a section break, deleting the first page will generally preserve the numbering of the remaining document. However, verify that your section breaks are not accidentally deleted by the macro.

Can I run this macro on hundreds of documents at once?

The basic macro provided only works on the currently active document. To process multiple files simultaneously, you would need to write an extended VBA script that loops through a specific folder, opens each file, runs the deletion command, and saves them automatically.