H
Hollis D. Paul
I have this function that will open a word document, apply a template,
copy in the HTMLBody property of an Outlook message, and then save it
as an XML file.
I want to select the subject line in the document and construct a file
name out of it. Howver, every time I try to find the word subject with
a range object, it blows my function out of the water, and never saves
the file. Actually, when the MyDoc object loses scope the dialog box
pops up and asks if I want to save the changes.
Here is the function:
Function PrintDocs(o_item,strWordTemplate)
dim strSaveName
dim strIce9
Dim MyDoc
Dim MyRange
'Dim MySel
strSaveName = "TestDoc" & i+1 & ".XML"
'MsgBox strSaveName
'Open a new letter based on the selected template
appWord.Documents.Add strWordTemplate
appWord.Visible = True
Set MyDoc = appWord.ActiveDocument
MyDoc.Content.InsertAfter o_item.HTMLBody
Set MyRange = MyDoc.Content
'MyRange = MyDoc.Content.Collapse(1)
MsgBox "Test textbox Point1"
'MyRange.Find "Subject:"
strIce9 = "strIce9:" & MyRange.Text & "endstrIce9"
'MySel.InsertAfter strIce9
MsgBox "Test textbox Point2"
MyDoc.SaveAs strSaveName, 8
'MyDoc.close
'Write information to Word custom document properties
'Set prps = appWord.ActiveDocument.CustomDocumentProperties
' MsgBox "Do we see a document?"
Set MyRange = Nothing
Set MyDoc = Nothing
fLetterCreated = True
End Function
How do I find my Text Subject: , collect the rest of the line, delete
spaces and chop it off at 20 characters? Or just the first step? I
love a good flail at times, but this is not a good time.
The source text that is put in the document follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>From: "kanth"
<[email protected]><BR>
Subject: How to set template to MySite.<BR>
Date: Sun, 14 Nov 2004 19:22:09 -0800<BR>
Newsgroups: microsoft.public.sharepoint.portalserver<BR>
<BR>
<BR>
Hi Everyone,<BR>
<BR>
I would like to set a template for mysite. Here, I want to create a<BR>
template with some organization webparts and by default when the
user<BR>
creates mysite, this template should apply. <BR>
<BR>
Any ideas would be appreciated.<BR>
<BR>
Thanks a lot.<BR>
- Ravi Kanth<BR>
<BR>
*********<BR>
<BR>
From: "James Mueller"
<[email protected]><BR>
Subject: Re: How to set template to MySite.<BR>
Date: Sun, 14 Nov 2004 10:12:24 -0600<BR>
Newsgroups: microsoft.public.sharepoint.portalserver<BR>
<BR>
<BR>
You can edit the SPSMSITE default.aspx and public.aspx pages to
include<BR>
information, document libraries, and lists.<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>
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
copy in the HTMLBody property of an Outlook message, and then save it
as an XML file.
I want to select the subject line in the document and construct a file
name out of it. Howver, every time I try to find the word subject with
a range object, it blows my function out of the water, and never saves
the file. Actually, when the MyDoc object loses scope the dialog box
pops up and asks if I want to save the changes.
Here is the function:
Function PrintDocs(o_item,strWordTemplate)
dim strSaveName
dim strIce9
Dim MyDoc
Dim MyRange
'Dim MySel
strSaveName = "TestDoc" & i+1 & ".XML"
'MsgBox strSaveName
'Open a new letter based on the selected template
appWord.Documents.Add strWordTemplate
appWord.Visible = True
Set MyDoc = appWord.ActiveDocument
MyDoc.Content.InsertAfter o_item.HTMLBody
Set MyRange = MyDoc.Content
'MyRange = MyDoc.Content.Collapse(1)
MsgBox "Test textbox Point1"
'MyRange.Find "Subject:"
strIce9 = "strIce9:" & MyRange.Text & "endstrIce9"
'MySel.InsertAfter strIce9
MsgBox "Test textbox Point2"
MyDoc.SaveAs strSaveName, 8
'MyDoc.close
'Write information to Word custom document properties
'Set prps = appWord.ActiveDocument.CustomDocumentProperties
' MsgBox "Do we see a document?"
Set MyRange = Nothing
Set MyDoc = Nothing
fLetterCreated = True
End Function
How do I find my Text Subject: , collect the rest of the line, delete
spaces and chop it off at 20 characters? Or just the first step? I
love a good flail at times, but this is not a good time.
The source text that is put in the document follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>From: "kanth"
<[email protected]><BR>
Subject: How to set template to MySite.<BR>
Date: Sun, 14 Nov 2004 19:22:09 -0800<BR>
Newsgroups: microsoft.public.sharepoint.portalserver<BR>
<BR>
<BR>
Hi Everyone,<BR>
<BR>
I would like to set a template for mysite. Here, I want to create a<BR>
template with some organization webparts and by default when the
user<BR>
creates mysite, this template should apply. <BR>
<BR>
Any ideas would be appreciated.<BR>
<BR>
Thanks a lot.<BR>
- Ravi Kanth<BR>
<BR>
*********<BR>
<BR>
From: "James Mueller"
<[email protected]><BR>
Subject: Re: How to set template to MySite.<BR>
Date: Sun, 14 Nov 2004 10:12:24 -0600<BR>
Newsgroups: microsoft.public.sharepoint.portalserver<BR>
<BR>
<BR>
You can edit the SPSMSITE default.aspx and public.aspx pages to
include<BR>
information, document libraries, and lists.<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>
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