Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Mailmerge Send e-mail but change the "From:"

Status
Not open for further replies.

PWD

Technical User
Jul 12, 2002
823
GB
Good morning. I have pulled together enough code to send an e-mail with my MailMerge attachments
Code:
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Set oOutlookApp = GetObject(, "Outlook.Application")

With oItem
    .To = "des.lavender@xyz.com"
    .Subject = "Project Flag Sheet"
    'Add the document as an attachment, you can use the .displayname property
    'to set the description that's used in the message
    .Body = "Hello. These are the Mailmerge documents." & vbCrLf & _
    vbCrLf & "Best regards"
    For i = 1 To UBound(MyArray)
    '(Is there a better way of doing this?)
        .Attachments.Add Source:=MyArray(i), Type:=olByValue, DisplayName:="Document as attachment"
    
    Next i
    
    .Send
End With
But I'm wondering if it's possible to change the "From:" in the message so the recipient can set up a Rule to put these messages in a particular folder in their Inbox? Or at the very least so they can differentiate these messages from any others received from me.

I've tried using
Code:
.SenderName = "TEST"
but get an error message
Compile error:
Can't assign to read-only property

Many thanks,
D€$
 
Whoops, omitted this code from the post
Code:
Set oItem = oOutlookApp.CreateItem(olMailItem)

Many thanks,
D€$
 
Have you tried the SentOnBehalfOfName property ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi, thanx. It works, sort of - it must still be a valid e-mail address from within our company's system to use this property, but I don't having sending rights for anyone else's mailbox. I suppose I should have been more specific; what I'd like to be able to do, if at all possible, is just change the displayed "From" from Des Lavender to, well, anything we decide upon.

As I said it's only a 'like' so it's really no big deal if it's not possible.

Many thanks,
D€$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top