Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

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.