mark hansen
Well-known Member
- Joined
- Mar 6, 2006
- Messages
- 534
- Office Version
- 2016
- Platform
- Windows
I have been using Excel to create a report, that is then pasted into another application. Because of the restrictions of the other application, I need to copy the information from Excel, Paste it into Word, and then copy from Word to paste into the application. (it has to do with merged cells in Excel being unmerged when pasted directly into our application).
So no problem... the Excel code opens word in the back ground, does the pasting, then selects everything in word, copies it, and closes word.
I discovered I'm leaving zombie processes of word hanging around because I only use
Set wdapp = New Word.Application (to Start word)
Set wdapp = Nothing (to close word)
I've done some searches and discovered I need to put
wdapp.Quit SaveChanges:=wdDoNotSaveChanges
before I use Set wdapp = Nothing line to stop word.
During my research I came across something that says I need to close the document object before I close the application object.
if I put ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
it closes down the wrong document. (we run with 2-3 word document open most of the time.)
if I truly need to close the word document before the application, how can I select which word document? I can get the name of the newly created word document in a variable and use that to close just that word document?
Mark
So no problem... the Excel code opens word in the back ground, does the pasting, then selects everything in word, copies it, and closes word.
I discovered I'm leaving zombie processes of word hanging around because I only use
Set wdapp = New Word.Application (to Start word)
Set wdapp = Nothing (to close word)
I've done some searches and discovered I need to put
wdapp.Quit SaveChanges:=wdDoNotSaveChanges
before I use Set wdapp = Nothing line to stop word.
During my research I came across something that says I need to close the document object before I close the application object.
if I put ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
it closes down the wrong document. (we run with 2-3 word document open most of the time.)
if I truly need to close the word document before the application, how can I select which word document? I can get the name of the newly created word document in a variable and use that to close just that word document?
Mark