R
Russ
The document in question was created in Word 2003. I am having a problem
running it in Word 2007. The document (Doc A) has nothing but a Start button
which runs code which does the following:
• Opens an Excel file and reads the contents into a Word VBA array
• Closes the Excel file
• Opens a second word document (Doc B) which has a table which acts as a
template for the excel data. This document contains no code. All the code
resides in Doc A
• Copies data to the template (Doc B) from the array and then copies it to
Doc A building a large 50 plus page document
• Saves Doc A with a new name Doc C
• Here is where the problem arises – The code closes Doc B without saving
the changes which should just leave Doc C, the finished document. That is
how it worked in Word 2003. However, in Word 2007 I am left with two windows
of Word. One contains the finished document Doc C. The second is labeled
Word but is blank (no file open). How do I get rid of this second blank
Word window using VBA?
It’s a little strange that if I manually close Doc C it closes but leaves
Doc B open. However, if I manually close Doc B it closes and also closes Doc
C.
running it in Word 2007. The document (Doc A) has nothing but a Start button
which runs code which does the following:
• Opens an Excel file and reads the contents into a Word VBA array
• Closes the Excel file
• Opens a second word document (Doc B) which has a table which acts as a
template for the excel data. This document contains no code. All the code
resides in Doc A
• Copies data to the template (Doc B) from the array and then copies it to
Doc A building a large 50 plus page document
• Saves Doc A with a new name Doc C
• Here is where the problem arises – The code closes Doc B without saving
the changes which should just leave Doc C, the finished document. That is
how it worked in Word 2003. However, in Word 2007 I am left with two windows
of Word. One contains the finished document Doc C. The second is labeled
Word but is blank (no file open). How do I get rid of this second blank
Word window using VBA?
It’s a little strange that if I manually close Doc C it closes but leaves
Doc B open. However, if I manually close Doc B it closes and also closes Doc
C.