B
Bonnie
I have created a template that contains a macro that will save the
document and then email it to 3 people. This all works fine from my xp
prof system running office 2003. However, from a win 98se system
running office 97, it sends an email with no attachment. This is all
brand new to me and I've been learning as I go and have no idea what is
wrong. Can anyone help me? Here is the code:
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
ActiveDocument.SaveAs
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "(e-mail address removed); (e-mail address removed);
(e-mail address removed);"
.Subject = "New Maintenance Work Order"
'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"
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
document and then email it to 3 people. This all works fine from my xp
prof system running office 2003. However, from a win 98se system
running office 97, it sends an email with no attachment. This is all
brand new to me and I've been learning as I go and have no idea what is
wrong. Can anyone help me? Here is the code:
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
ActiveDocument.SaveAs
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "(e-mail address removed); (e-mail address removed);
(e-mail address removed);"
.Subject = "New Maintenance Work Order"
'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"
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub