From: Greg Maxey on 31 Mar 2010 17:28 If is just a temporary document that you are using for processing then just close it without saving: oDocB.Close wdDoNotSaveChanges "Richard" <Richard(a)discussions.microsoft.com> wrote in message news:E57A4494-3625-46BE-9C22-AE2E30259023(a)microsoft.com... > Hi > > Many thanks for help. Original question answered & all working. > > If one wants to then delete the new document (oDocB), how would you go > about > that? > > -- > Richard > > > "Greg Maxey" wrote: > >> Sub ScratchMaco() >> Dim oDocA As Word.Document >> Dim oDocB As Word.Document >> Set oDocA = ActiveDocument 'Set the active document >> Set oDocB = Documents.Add 'Create new document. It becomes active >> MsgBox ActiveDocument >> oDocA.Activate 'make oDocA active >> MsgBox ActiveDocument >> oDocB.Activate 'make oDocB active >> MsgBox ActiveDocument >> oDocB.Close wdDoNotSaveChanges 'close the active document >> MsgBox ActiveDocument 'remaining open document becomes active. >> End Sub >> >> >> "Richard" <Richard(a)discussions.microsoft.com> wrote in message >> news:CCC22189-D3B0-4CF3-AF59-96546AEDEE9A(a)microsoft.com... >> > Hi >> > >> > I have a form.doc (A) which I need to e-mail to 3rd parties without the >> > code >> > to reduce file size. >> > >> > Code has been written to copy the text from the form to a new document >> > (B), >> > which I then need to save to enable it to be e-mailed via Outlook. >> > >> > The original document (A) is still the activeDocument, but to save the >> > new >> > one (B), (B) needs to be the activeDocument for the code: >> > >> > ActiveDocument.Save >> > >> > to work. >> > >> > So, How do I make (B) the ActiveDocument (Which is not saved) & later >> > make >> > (A) the activeDocument to perform further tasks? >> > >> > Templates (.dot) are deliberately not being used as references get lost >> > when >> > files are moved in a big organisation. >> > >> > All contributions gratefully received. >> > >> > Thanks - Richard >> > -- >> > Richard >> >> >> . >>
First
|
Prev
|
Pages: 1 2 Prev: Deleting a specific field code in Footers Next: Character code for Enter Key |