SAbboushi
asked on
How to figure out the name of Outlook 2007 MailItem fields and how to reference them in VBA
Having a tough time with concepts and how to reference fields...
Someone refered me to MSDN but I am clueless...
I manually fill in the "From:" and "bcc" fields constantly. I want to set these fields with default values e.g. "abc@xyz.com"
How do I quickly figure out the names of the From and bcc fields, how to reference them, etc...? I don't know whether to look in the MAPI reference, or the Developer reference, or... (and isn't there an object browser or something like that which can help make it easier?)
Note: to see the "From:" field, you need to set Outlook to display it (same with bcc field):
To display these fields, create a new e-mail message, select Options; in the Fields section, click on "Show From" and "Show bcc".
I am seeking the lines of code to set these 2 fields of a reply message to "abc@xyz.com"
And if your name is Chris Bottomley, even better ; )
Someone refered me to MSDN but I am clueless...
I manually fill in the "From:" and "bcc" fields constantly. I want to set these fields with default values e.g. "abc@xyz.com"
How do I quickly figure out the names of the From and bcc fields, how to reference them, etc...? I don't know whether to look in the MAPI reference, or the Developer reference, or... (and isn't there an object browser or something like that which can help make it easier?)
Note: to see the "From:" field, you need to set Outlook to display it (same with bcc field):
To display these fields, create a new e-mail message, select Options; in the Fields section, click on "Show From" and "Show bcc".
I am seeking the lines of code to set these 2 fields of a reply message to "abc@xyz.com"
And if your name is Chris Bottomley, even better ; )
ASKER
Not an account and yes it is legit ; )
By filling in the From: field manually, it overrides the reply-to e-mail address for the recipient: the recipient sees "From Sam [mailto:Sam@xyz.com] On Behalf Of abc@xyz.com"
When the recipient clicks on 'Reply', the reply-to e-mail address becomes 'abc@xyz.com' even though 'Sam@xyz.com' is 'account' e-mail address
By filling in the From: field manually, it overrides the reply-to e-mail address for the recipient: the recipient sees "From Sam [mailto:Sam@xyz.com] On Behalf Of abc@xyz.com"
When the recipient clicks on 'Reply', the reply-to e-mail address becomes 'abc@xyz.com' even though 'Sam@xyz.com' is 'account' e-mail address
In that case fine you are looking at the reply to I was thinking about:
See the three modified subs below, the replyrecipients is the same as you show above for on behalf of ... the reply goes in this case to norm"norman.com ... you might want to edit that though ;o)
Chris
See the three modified subs below, the replyrecipients is the same as you show above for on behalf of ... the reply goes in this case to norm"norman.com ... you might want to edit that though ;o)
Chris
Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
Response.Subject = Response.Subject & "X"
' Response.SendUsingAccount = Application.Session.Accounts("me@my.com")
Response.ReplyRecipients.Add "norm@norman.com"
Response.BCC = "doris@doris.com"
End Sub
Private Sub myItem_Forward(ByVal Forward As Object, Cancel As Boolean)
Forward.Subject = Forward.Subject & "X"
' Response.SendUsingAccount = Application.Session.Accounts("me@my.com")
Response.ReplyRecipients.Add "norm@norman.com"
Response.BCC = "doris@doris.com"
End Sub
Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean)
Response.Subject = Response.Subject & "X"
' Response.SendUsingAccount = Application.Session.Accounts("me@my.com")
Response.ReplyRecipients.Add "norm@norman.com"
Response.BCC = "doris@doris.com"
End Sub
OOPS!
The forward sub is a different object ... corrected here.
Chris
The forward sub is a different object ... corrected here.
Chris
Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
Response.Subject = Response.Subject & "X"
' Response.SendUsingAccount = Application.Session.Accounts("me@mine.com")
Response.ReplyRecipients.Add "norm@norman.com"
Response.BCC = "doris@doris.com"
End Sub
Private Sub myItem_Forward(ByVal Forward As Object, Cancel As Boolean)
Forward.Subject = Forward.Subject & "X"
' Forward.SendUsingAccount = Application.Session.Accounts("me@mine.com")
Forward.ReplyRecipients.Add "norm@norman.com"
Forward.BCC = "doris@doris.com"
End Sub
Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean)
Response.Subject = Response.Subject & "X"
' Response.SendUsingAccount = Application.Session.Accounts("me@mine.com")
Response.ReplyRecipients.Add "norm@norman.com"
Response.BCC = "doris@doris.com"
End Sub
ASKER
Forward button results in 'Object required' run-time error... problem with
Also, is there a more reliable way to set m_Inspectors? Any problems (such as this one) requires that I manually run application_startup after I see that the code isn't working anymore
Bigger problem: "From:" field is not being set (bcc works great - thanks!)
Response.ReplyRecipients.Add "norm@norman.com"
Also, is there a more reliable way to set m_Inspectors? Any problems (such as this one) requires that I manually run application_startup after I see that the code isn't working anymore
Bigger problem: "From:" field is not being set (bcc works great - thanks!)
ASKER
Found it: Response.SentOnBehalfOfNam
Still don't have solution for Forward button...
replyrecipients ought to work, but forward will be forward.sentonbehalfofname ...
Chris
Chris
ASKER
thanks - I will try that
You've made it easier for me by providing the field names - thanks. Can you tell me how I can find them myself for next time? My noob approach is highly time-intensive!
I've read about an object browser & msdn... what is the best resource to help me identify the field references I want (other than Chris!)? ; )
You've made it easier for me by providing the field names - thanks. Can you tell me how I can find them myself for next time? My noob approach is highly time-intensive!
I've read about an object browser & msdn... what is the best resource to help me identify the field references I want (other than Chris!)? ; )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great - thanks again!
If it is an account in outlook then can do ... if it isn't then not so much but we can set the reply address.
Chris