Sending Word doc as attachments-automatic subject line

J

Jackie

In Microsoft Office 2000 when a word document was sent as an attachment the
subject line would automatically appear with the title I had assigned it in
the properties of the word document.
In Microsoft Office 2003, this no longer happens. The subject line no longer
takes the title of the Template the document was created from, it only takes
the document name. We have may rules set up when documents are sent that
since upgrading to Office 2003 have not been as useful. I need help in
determining how to get this subject line to automatically show up as before
when using Office 2000
Thank you,
 
P

Peter Jamieson

I don't know of a simple way to work around this change (which happened in
Office 2002) - the only thing I can suggest is that you construct your own
macro. The following code is untested and is based on Astrid Zeelenberg's
example at the Word MVP site -

http://word.mvps.org/faqs/interdev/sendmailcontent.htm

It really assumes that you have just saved the current document to disk.

Sub SendDocumentInMail()

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

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

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

With oItem
'Set the recipient for the new email - edit this, or comment this out if
your users should enter the address
.To = "(e-mail address removed)"
'Set the recipient for a copy - edit this, or comment this out if your
users should enter the address
'.CC = "(e-mail address removed)"
'Set the subject to be the document title
.Subject = ActiveDocument.BuiltInDocumentProperties("Title")
'The content of the document is used as the body for the email - change
this to be whatever you want
'.Body = ActiveDocument.Content
.Attachments.Add Source:= _
ActiveDocument.FullName, _
Type:=olByValue, _
Position:=1, _
DisplayName:="my attachment"
' in this case, just display the result
.Display
End With

If bStarted Then
'If we started Outlook from code, then close it
oOutlookApp.Quit
End If

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub


Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top