Using Visual Basic template in Word, I am currently creating an email to be sent to a specific department. I'm using redemption to create the email and I'd like to pull a section of the document created from the template into the body of the email. I'd prefer not to create a separate document to be attached to the email. I've tried retrieving the contents of a bookmark:
activedocument.bookmarks("Routing_Slip"
.range.text
and it works, but it does not retain the formatting or the bullets on the original document. Without code, I can highlight the section, copy, select the open email, paste, and it pastes beautifully.
Is there anyway (using vba code) to select the body of the created email and just paste text into it? Here is my code for the redemption function itself:
Function SendEmail()
Dim SafeItem, oItem, ccRecipient As Object
Dim olapp As Outlook.Application
Dim nspnamespace As Outlook.NameSpace
Set olapp = Outlook.Application
Set nspnamespace = olapp.GetNamespace("Mapi"
Set SafeItem = CreateObject("outlook.SafeMailItem"
Set oItem = olapp.CreateItem(0)
SafeItem.Item = oItem
SafeItem.Recipients.Add "supportdepartment"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Amendment Routing Sheet"
Selection.Paste
Set olapp = Nothing
Set nspnamespace = Nothing
Set SafeItem = Nothing
Set oItem = Nothing
End Function
Or does anyone have any other ideas?
Thanks for your help
Code:
Code:
and it works, but it does not retain the formatting or the bullets on the original document. Without code, I can highlight the section, copy, select the open email, paste, and it pastes beautifully.
Is there anyway (using vba code) to select the body of the created email and just paste text into it? Here is my code for the redemption function itself:
Code:
Dim SafeItem, oItem, ccRecipient As Object
Dim olapp As Outlook.Application
Dim nspnamespace As Outlook.NameSpace
Set olapp = Outlook.Application
Set nspnamespace = olapp.GetNamespace("Mapi"
Set SafeItem = CreateObject("outlook.SafeMailItem"
Set oItem = olapp.CreateItem(0)
SafeItem.Item = oItem
SafeItem.Recipients.Add "supportdepartment"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Amendment Routing Sheet"
Selection.Paste
Set olapp = Nothing
Set nspnamespace = Nothing
Set SafeItem = Nothing
Set oItem = Nothing
End Function
Code:
Or does anyone have any other ideas?
Thanks for your help