Hello
Maybe this is a little bit off-topic because it's about Word & VBA and not Excel & VBA but I found that it fits best in this category...
I'm having a word document which can be sent to Outlook automatically. This is done by creating a new Outlook message (specified: outlook invitation) and then attaching the (temporary saved) doc-file as attachment to the message. It's all done with vba and looks like this:
Code:
Private Sub einladungErstellen()
Dim objOL 'As Outlook.Application
Dim objAppt 'As Outlook.AppointmentItem
Dim attPath As String
Const olAppointmentItem = 1
Const olMeeting = 1
attPath = Tempfile
Set objOL = CreateObject("Outlook.Application")
Set objAppt = objOL.CreateItem(olAppointmentItem)
With objAppt
.Subject = Title
.Start = Startdate
.End = Enddate
.Location = RoomName
.MeetingStatus = olMeeting ' make it a meeting request
.Attachments.Add attPath
.Body = "This is a test-text in the message body..."
.Display
End With
Set objAppt = Nothing
Set objOL = Nothing
Kill Tempdatei
End Sub
When I run the code, everything is working well and without any problems. But I would like to paste the formatted content of the word file directly to the message body. At the moment, I only know how to send unformatted text to the message body:
Code:
objAppt.Body = "This is my text"
How can I send formatted text as body content?
=> Maybe one could do this with a complete different approach: It's possible to copy the worddocument-content to clipboard and then paste it manually in the generated outlook message with 'ctrl+v'. Would it be possible to automate this?
thank you,
saimen