Reputation: 1984
I'm writing excel/vba to read a word file and parse through the contents, creating a CSV file from those contents.
I have a loop that looks like this:
with doc
for each para in doc.paragraphs
DoEvents
txt = trim(para.range.text)
debug.print txt
next
end with
More code will be forthcoming as I figure this out. However, I have encountered a problem when I click the stop button in the developer ribbon - the doevents does catch it and stop running. However, the windows file is still open and it causes an error for the next time around. Is there a way to catch the doevents and have it close all the other open files?
Upvotes: 0
Views: 158