Looping through word and writing to excel when certain conditions are met
Apologies up front if this has been answered in a previous post, however I've been looking for a number of days now and haven't been able to solve my problem.
I have a macro which loops through all paragraphs in a word document.
While it loops through, it evaluates the font style, and updates a number of variables which will be passed to excel when a condition is met (para.style = normal). I then want to take the variables and write them to a new row in excel. It then goes back to the word document and resumes looping through the paragraphs until the condition is next met.
When I was first writing the code, I was using an earlier OS and version of office, and the existing code worked to completion and the excel worksheet was fully populated with the full content of the word Document.
When I tried to run the code on my machine (which I use more often than not) and start handling other issues (tables), the macro worked to the point of creating the first row in excel, but when it came to writing the next (and subsequent rows), it doesn't appear to activate the worksheet.
I have attached the code and the target xls sheet. I'd be appreciative if anyone can steer me in the right direction.
|