PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Send As Property Outlook VBA

Reply

Send As Property Outlook VBA

 
Thread Tools Rate Thread
Old 15-03-2006, 03:54 PM   #1
mac7attack@gmail.com
Guest
 
Posts: n/a
Default Send As Property Outlook VBA


Hello all,

Is there a VBA property for a mailitem to change the Send As field? I
would like for the email to come from my team's group mailbox and not
the user who is running the script. My test code as follows.
The SenderEmailAddress property returns a Read-only run-time error.


Sub TestEmail()
Dim position As Long
Dim OLobj As Object
Dim Mailobj As Object
Dim BodyStr As String
Dim SectStr As String


Set OLobj = CreateObject("Outlook.Application")
Set Mailobj = OLobj.CreateItem(olMailItem)
With Mailobj
'.Senderemailaddress = "GroupMB@corp.com"
.To = "mac7attack@gmail.com
.Subject = "Testing VBA"
.Body = "Testing"
.Send
End With

Set Mailobj = Nothing
Set OLobj = Nothing

End Sub

Thanks in advanced,

Matt

  Reply With Quote
Old 15-03-2006, 04:12 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Send As Property Outlook VBA

If you're referring to an Exchange mailbox, use the MailItem.SentOnBehalfOfName property.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


<mac7attack@gmail.com> wrote in message news:1142438065.298348.116060@e56g2000cwe.googlegroups.com...
> Hello all,
>
> Is there a VBA property for a mailitem to change the Send As field? I
> would like for the email to come from my team's group mailbox and not
> the user who is running the script. My test code as follows.
> The SenderEmailAddress property returns a Read-only run-time error.
>
>
> Sub TestEmail()
> Dim position As Long
> Dim OLobj As Object
> Dim Mailobj As Object
> Dim BodyStr As String
> Dim SectStr As String
>
>
> Set OLobj = CreateObject("Outlook.Application")
> Set Mailobj = OLobj.CreateItem(olMailItem)
> With Mailobj
> '.Senderemailaddress = "GroupMB@corp.com"
> .To = "mac7attack@gmail.com
> .Subject = "Testing VBA"
> .Body = "Testing"
> .Send
> End With
>
> Set Mailobj = Nothing
> Set OLobj = Nothing
>
> End Sub
>
> Thanks in advanced,
>
> Matt
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off