Re: Closing current instance of Word 2003 by Perry
Perry
Sun Mar 11 09:05:50 CDT 2007
> Obviously I have Word set to the (more or less) equivalent of classic MDI,
> each instance in its own window.
If you´ve coded correctly, you can quit each object variable pointing to a
newly created
Word instance seperately.
This is a sequence within Word VBA (!) examplifying object orientated coding
in which
each instance can be addressed seperately and in yr case: killed seperately:
(actually a bit of "inter appliation" automation ... oops that didn't sound
too good, now did it? ....)
Dim Inst1 As New Word.Application
Dim Inst2 As New Word.Application
Dim Doc1 As Document
Dim Doc2 As Document
Inst1.Visible = True
Inst2.Visible = True
Set Doc1 = Inst1.Documents.Add
Set Doc2 = Inst2.Documents.Add
Doc1.Windows(1).Visible = True
Doc2.Windows(1).Visible = True
Doc1.Range(0, 0).InsertAfter "text in doc1"
Doc2.Range(0, 0).InsertAfter "text in doc2"
Doc1.Close 0
Inst1.Quit: Set Inst1 = Nothing
'Now all actions of Inst1 are processed, leaving you Inst2 with document and
the text to proof this.
' Note: all other previsouly instances of Word should be intact as well !
--
Krgrds,
Perry
System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
"Paul B" <pb_publicR.e.m.o.v.e@operamail.com> schreef in bericht
news:13nrdnvfcvlv3.dlg@pbpublic.invalid...
> Hi,
>
> I'm trying to close the current instance of Word 03 without affecting any
> other open instances.
>
> So far I've got
>
> ActiveDocument.Close savechanges:=wdSaveChanges
>
> but that only closes the document, leaving the application window still
> open.
>
> Obviously I have Word set to the (more or less) equivalent of classic MDI,
> each instance in its own window.
>
> Any help would be appreciated.
>
> Thanks and BW,
> p.