# How to Delete multiple continuous pages in MS Word using Excel VBA ?



## ajay1111 (Dec 29, 2022)

I have a list of pages that I want to delete in MS Word such as _Page number : 5 to 10 , 12-16 etc._ through Microsoft Excel VBA. 
I found a code to delete specific pages through MS Word VBA. How can it be achieved through MS Excel VBA.


```
Dim Rng As Range, iPage As Long
iPage = 2
With ActiveDocument
  Set Rng = .GoTo(What:=wdGoToPage, Name:=iPage)
  Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
  Rng.Delete
End With
```


----------



## rakesh seebaruth (Dec 30, 2022)

Dim myRange As Range 
Set myRange = ActiveDocument.Range(Start:=ActiveDocument.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=5).Start, _ 
End:=ActiveDocument.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=10).End) 
myRange.Delete 

Set myRange = ActiveDocument.Range(Start:=ActiveDocument.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=12).Start, _ 
End:=ActiveDocument.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=16).End) 
myRange.Delete.

End Sub


----------

