H
Hollis D. Paul
I have an Outlook/Exchange Inbox folder with about 150 messages that I
want to stuff the HTMLBody property into a Word Document and save it as
a WordML document in a specific folder. All this using VBScript. I
have started with one of Helen Feddema's scripts (code31, I believe)
and have gotten it to make a restricted set based on category, and I
can get it to open a file for each item in the restricted set. I have
been given the following line as the way to get the Ritem.HTMLBody into
a Word Object, but if I execute it the documents disappear. Executing
the TypeText line blows them away also.
Will someone please give me a hint about how to get the Outlook
property into the document?
I also need help saving the document. If I set the strSaveName to
Name.XML, it saves it with an XML extension, but it has the usual Word
objects inside and it blows up when you try to open it. I need to get
it to convert to XML before I save it, I guess. Any help on this?
Function PrintDocs(o_item,strWordTemplate)
dim strSaveName
strSaveName = "C:\Temp\TestDoc"
'Open a new letter based on the selected template
appWord.Documents.Add strWordTemplate
' appWord.ActiveDocument.Selection.TypeText "This is my document"
' appWord.ActiveDocument.HTMLProject.HTMLProjectItems(1) =_
o_item.HTMLBody
'Write information to Word custom document properties
'Set prps = appWord.ActiveDocument.CustomDocumentProperties
appWord.Visible = True
appWord.Activate
MsgBox "Do we see a document?"
'Update fields in Word document and activate it
appWord.Selection.WholeStory
appWord.Selection.Fields.Update
appWord.Selection.HomeKey 6
' appWord.ActiveDocument.SaveAs strSaveName
'appWord.ActiveWindow.WindowState = 0
fLetterCreated = True
End Function
Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access, Windows 2000 build 2600
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US
Mukilteo, WA USA
want to stuff the HTMLBody property into a Word Document and save it as
a WordML document in a specific folder. All this using VBScript. I
have started with one of Helen Feddema's scripts (code31, I believe)
and have gotten it to make a restricted set based on category, and I
can get it to open a file for each item in the restricted set. I have
been given the following line as the way to get the Ritem.HTMLBody into
a Word Object, but if I execute it the documents disappear. Executing
the TypeText line blows them away also.
Will someone please give me a hint about how to get the Outlook
property into the document?
I also need help saving the document. If I set the strSaveName to
Name.XML, it saves it with an XML extension, but it has the usual Word
objects inside and it blows up when you try to open it. I need to get
it to convert to XML before I save it, I guess. Any help on this?
Function PrintDocs(o_item,strWordTemplate)
dim strSaveName
strSaveName = "C:\Temp\TestDoc"
'Open a new letter based on the selected template
appWord.Documents.Add strWordTemplate
' appWord.ActiveDocument.Selection.TypeText "This is my document"
' appWord.ActiveDocument.HTMLProject.HTMLProjectItems(1) =_
o_item.HTMLBody
'Write information to Word custom document properties
'Set prps = appWord.ActiveDocument.CustomDocumentProperties
appWord.Visible = True
appWord.Activate
MsgBox "Do we see a document?"
'Update fields in Word document and activate it
appWord.Selection.WholeStory
appWord.Selection.Fields.Update
appWord.Selection.HomeKey 6
' appWord.ActiveDocument.SaveAs strSaveName
'appWord.ActiveWindow.WindowState = 0
fLetterCreated = True
End Function
Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access, Windows 2000 build 2600
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US
Mukilteo, WA USA