Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there any thing wrong with below snippet? Macro execution halts highlighting the fourth line, but no error messages. Please help
sub removeUnusedSheets(retain)
cntsheets= ActiveDocument.NoofSheets
for sindx=cint(retain)+1 to cntsheets-1
ActiveDocument.RemoveSheet sindx
next
end sub
It is possible that the sheet number doesn't exist or not properly created. To find out, add line
msgbox(sindx)
in the loop before your fourth line.