McKilty
2009-10-12 12:16:25 UTC
I have a routine which opens Word and writes e-mails to it. When it
closes, I get an error regarding the default template and how it can't
be overwritten because it's in use. This is caused, in part, by using
Word as the e-mail editor.
Prior to running the program, if I manually check my Windows processes
for WINWORD.exe, there is one there already caused by Outlook using
Word as an editor. If I close it and then run my app there is no
problem.
The template being references is Normal.dot and I try to use a
different template right off the bat to get around this.
If I don't close it, I get the error. The Word code within my Outlook
macro is:
*******************************************************
Dim myWord As Word.Application
Dim myDoc As Word.Document
Dim sWordString As String
Set myWord = New Word.Application
Set myDoc = myWord.Documents.Add("C:\Program Files\DLB\DailySRE
\FolderExport.dot")
sWordFile = "C:\" & myOutlook.ActiveExplorer.CurrentFolder.Name &
".doc"
myDoc.SaveAs sWordFile
~ SNIP ~
myDoc.Save
myDoc.Close
myWord.Quit
Set myDoc = Nothing
Set myWord = Nothing
**************************************************
This may be the wrong forum, but it is being run in Outlook VBA...
closes, I get an error regarding the default template and how it can't
be overwritten because it's in use. This is caused, in part, by using
Word as the e-mail editor.
Prior to running the program, if I manually check my Windows processes
for WINWORD.exe, there is one there already caused by Outlook using
Word as an editor. If I close it and then run my app there is no
problem.
The template being references is Normal.dot and I try to use a
different template right off the bat to get around this.
If I don't close it, I get the error. The Word code within my Outlook
macro is:
*******************************************************
Dim myWord As Word.Application
Dim myDoc As Word.Document
Dim sWordString As String
Set myWord = New Word.Application
Set myDoc = myWord.Documents.Add("C:\Program Files\DLB\DailySRE
\FolderExport.dot")
sWordFile = "C:\" & myOutlook.ActiveExplorer.CurrentFolder.Name &
".doc"
myDoc.SaveAs sWordFile
~ SNIP ~
myDoc.Save
myDoc.Close
myWord.Quit
Set myDoc = Nothing
Set myWord = Nothing
**************************************************
This may be the wrong forum, but it is being run in Outlook VBA...