0

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?

Scott Craner
  • 148,073
  • 10
  • 49
  • 81
elbillaf
  • 1,952
  • 10
  • 37
  • 73

0 Answers0