How to Delete the First Page in Word Documents Using VBA
Question details
The user needs a reliable method to automatically remove the first page from multiple Word documents after they are completed.

- 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 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.
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.
Open your Word document and press Alt + F11 on your keyboard to launch the Microsoft Visual Basic for Applications window.
Click on 'Insert' in the top menu bar, then select 'Module' from the dropdown list to create a blank workspace for your 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
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.

Handle Document Protection Restrictions
If your Word templates are protected forms, the macro will fail unless protection is lifted prior to execution.
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. Open Your Document: Launch WPS Writer and open your Word template (.docm or .docx) that requires editing.
- 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. Insert the Macro: Go to Insert > Module, and paste your first-page deletion VBA script into the code window.
- 4. Run the Code: Click 'Run' to execute the macro, which will instantly remove the first page in your WPS Writer environment.

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.




