PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Send As Property Outlook VBA
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Send As Property Outlook VBA
![]() |
Send As Property Outlook VBA |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

