Question

Locked

Why my loop stops?

By mark.ivanowski ·
I have a code to export all codes to a text file. I have to export all codes in several woorkbooks... I use the code below but it stops after executing few files. any help?

Sub callExport()

Dim wkbk As Workbook
For Each wkbk In Application.Workbooks
Call ExportAllModules
Next wkbk

End Sub

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

At a guess there's a side effect

by Tony Hopkinson In reply to Why my loop stops?

in there that's messing with the workbooks collection.

Create your own and copy Application.workbooks into it, then iterate through that.

If that fixes the problem, have a major panic. Hopefully it will fall over in a big heap with a useful error message.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums