Question Locked

Why my loop stops?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

2 replies

by tony hopkinson

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.

This discussion is closed to new replies.