S
Sriram N A \(MICO/PJ-SAP-PP\) *
I'm trying to roll a home-grown random sig generator to use with Outlook and
I've gotten thus far:
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
With item
'Set Reference to Microsoft Word 11.0 Object Library
Dim Source As Document, findtext As Range
Dim iParCount As Long, iSigPara As Long
Const MyDoc = "C:\Documents and Settings\Desktop\Proverbs.doc"
Set Source = Documents.Open(MyDoc)
iParCount = Source.Paragraphs.Count
iSigPara = CLng(Rnd * iParCount)
Set findtext = Source.Paragraphs(iSigPara).Range
..HTMLBody = .HTMLBody & findtext
Source.Close
End With
End Sub
The problem is, the extract from the Word document loses formatting with
this approach. What's the best way of appending this text to the message
with all formatting?
I've gotten thus far:
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
With item
'Set Reference to Microsoft Word 11.0 Object Library
Dim Source As Document, findtext As Range
Dim iParCount As Long, iSigPara As Long
Const MyDoc = "C:\Documents and Settings\Desktop\Proverbs.doc"
Set Source = Documents.Open(MyDoc)
iParCount = Source.Paragraphs.Count
iSigPara = CLng(Rnd * iParCount)
Set findtext = Source.Paragraphs(iSigPara).Range
..HTMLBody = .HTMLBody & findtext
Source.Close
End With
End Sub
The problem is, the extract from the Word document loses formatting with
this approach. What's the best way of appending this text to the message
with all formatting?