R
red6000
Hi I have the code below from
(http://word.mvps.org/FAQs/InterDev/SendMail.htm)
It works great, but I don't want the recipient to know the email address of
the sender (and thus be able to reply to the mail).
Is it possible to amend the code to put a dummy email address of for
replying (ie (e-mail address removed))
Thanks
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
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 = TextBox1.Value
.Subject = TextBox2.Value
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
DisplayName:="Document as attachment"
.Body = "This mail has been sent from an unmanned email account,
please do not reply"
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
(http://word.mvps.org/FAQs/InterDev/SendMail.htm)
It works great, but I don't want the recipient to know the email address of
the sender (and thus be able to reply to the mail).
Is it possible to amend the code to put a dummy email address of for
replying (ie (e-mail address removed))
Thanks
Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
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 = TextBox1.Value
.Subject = TextBox2.Value
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
DisplayName:="Document as attachment"
.Body = "This mail has been sent from an unmanned email account,
please do not reply"
.Send
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub