mazatlan
07-09-2010, 11:28 AM
Hi:
I have a word template with one page and use a macro to add graphics and table to it. The problem is everytime I run the macro the document adds more pages. I need help with a loop to delete all the pages and shapes from my document leaving only the first page(template) to be reused again. I basically want to delete page 2 to last page everytime my macro runs so I can start with a fresh copy. I do have a loop to delete my shapes but the blank pages don't get deleted. Here is the loop I am using:
My file name is wordDoc.
with wordDoc.InlineShapes
Do While .Count > 0
.Item(1).Delete
Loop
End With
I don't know how to use the loop above to delete pages. Thanks for any help
I have a word template with one page and use a macro to add graphics and table to it. The problem is everytime I run the macro the document adds more pages. I need help with a loop to delete all the pages and shapes from my document leaving only the first page(template) to be reused again. I basically want to delete page 2 to last page everytime my macro runs so I can start with a fresh copy. I do have a loop to delete my shapes but the blank pages don't get deleted. Here is the loop I am using:
My file name is wordDoc.
with wordDoc.InlineShapes
Do While .Count > 0
.Item(1).Delete
Loop
End With
I don't know how to use the loop above to delete pages. Thanks for any help