View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default sending attachments in rich text format

You can either save the document as RTF then attach it to an e-mail message
or you could use the following macro to send it as an attachment with
Outlook. http://www.gmayor.com/installing_macro.htm. If you use the macro,
you must set a reference to the Outlook object library in the vba editor,
tools references.

Sub Send_As_Mail_Attachment()

' send the document as an attachment _
in an Outlook Email message
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim sFname, sSubject, sAsk As String
sFname = InputBox("Enter filename in the format 'Filename.rtf'")
If sFname = "" Then Exit Sub
Subject:
sSubject = InputBox("Enter the subject for the message")
If sSubject = "" Then
sAsk = MsgBox("Messages without a subject may be considered spam" & vbCr
& _
"Do you wish to enter a subject for this message?", vbYesNoCancel, "No
Subject")
If sAsk = vbNo Then GoTo Subject
If sAsk = vbCancel Then Exit Sub
End If

On Error Resume Next

'Prompt the user to save the document
ActiveDocument.SaveAs sFname, wdFormatRTF

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")

'Outlook wasn't running, start it from code
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "
'Set the recipient for a copy
.BCC = "
.Subject = "This is the subject"
'Add the document as an attachment, you can use the _
.displayname property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, _
Type:=olByValue, DisplayName:="Document as attachment"
.Display
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Wendy" wrote in message
...
Can anybody tell me how I send an attachment with an e-mail from within
Microsoft Office 2007 in rich text format please

Wendy