I am trying to get a macro that will delete all of the pages in the current document that have less than 5 layers. I tried the code below, but it doesn't work. I'm new to VBA so this might be way off.
Sub Macro1()
Dim p As PageDim i& For i = 1 To ActiveDocument.Pages.Count Set p = ActiveDocument.Pages(i) If ActivePage.Layers.Count < 5 Then ActivePage.Delete Next i End Sub
Thanks Eskimo of course you are right.
You are welcome, Mek. I only recognized it quickly because I had done that myself on more than one occasion!
I like Myron's "For Each Page in Pages" approach.