Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro execution halts

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

Labels (1)
1 Reply
Anonymous
Not applicable
Author

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.