Automate From Field

Hi all

I posted this last week but it seems MS deleted a load of its forums, 
including the VBA one I'd posted to :-(. So here goes again...

From MS Access 2003, I have a routine in code that automates an email. I can 
autofill the To, cc, subject, body field etc but now I need to also send 
from a different user using the 'From' field. I tried adding this in the 
same way to my code using:

 .from

but it seems this is not a supported method? I receive and Access error 438: 
Object does not support this property of method.

Please can any one tell me if this is possible and if so how to do it? If I 
leave for the user to enter the from email address manually it is very easy 
for them to miss this and just hit send, which would result in it being 
addressed as themselves. It is crucial that this does not happen as we are 
sending the emails on behalf of a different company.

Thanks for your help...

snipped of the Code, if I rem the .from line this will work ok...

        With objEmail
            .from "Me@test.com"
            .To = "SJH-" & dist
            .CC = "me@test.com"
            .BCC = "sue;fred;tom"
            .Subject = "Analysis Monthly Reports"
            .Body = "Test email please ignore... "
            .Attachments.Add strPath 


0
Sue
6/7/2010 8:31:03 AM
outlook.general 7254 articles. 4 followers. Follow

3 Replies
1471 Views

Similar Articles

[PageSpeed] 12

Hi just in case you spot the missing '=' sign this doesn't work still...

"Sue" <sportybabesue@hotmail.co.uk> wrote in message 
news:uqGZFvhBLHA.3880@TK2MSFTNGP04.phx.gbl...
> Hi all
>
> I posted this last week but it seems MS deleted a load of its forums, 
> including the VBA one I'd posted to :-(. So here goes again...
>
> From MS Access 2003, I have a routine in code that automates an email. I 
> can autofill the To, cc, subject, body field etc but now I need to also 
> send from a different user using the 'From' field. I tried adding this in 
> the same way to my code using:
>
> .from
>
> but it seems this is not a supported method? I receive and Access error 
> 438: Object does not support this property of method.
>
> Please can any one tell me if this is possible and if so how to do it? If 
> I leave for the user to enter the from email address manually it is very 
> easy for them to miss this and just hit send, which would result in it 
> being addressed as themselves. It is crucial that this does not happen as 
> we are sending the emails on behalf of a different company.
>
> Thanks for your help...
>
> snipped of the Code, if I rem the .from line this will work ok...
>
>        With objEmail
>            .from "Me@test.com"
>            .To = "SJH-" & dist
>            .CC = "me@test.com"
>            .BCC = "sue;fred;tom"
>            .Subject = "Analysis Monthly Reports"
>            .Body = "Test email please ignore... "
>            .Attachments.Add strPath
> 


0
Sue
6/7/2010 9:35:09 AM
In the future, you can use the Outlook for Developers forum at 
http://social.msdn.microsoft.com/Forums/en-US/outlookdev/threads for your 
Outlook coding questions. 

The object browser (F2 in VBA) is your friend: If you used it to look at the 
MailItem object in the Outlook object model, you'd see that there is no From 
property. That's the cause of your error. 

You didn't say what version of Outlook you're using, but I presume it's 
Outlook 2003.  That version provides no direct way to change the sender for 
an outgoing message. These are known workarounds using native Outlook 
functionality: 

1) If the user has Outlook 2002/3 and is not using WordMail as the editor, 
you set the sending account using CommandBars techniques. See 
http://www.outlookcode.com/codedetail.aspx?id=889 for sample code. 

2) In an Exchange environment where you want to use another user's mailbox 
as the From address, set the MailItem.SentOnBehalfOfName property. If you do 
not want the current user's name to appear in the message at all, the 
Exchange administrator must grant Send As permission on the other user's 
mailbox.  

Note that you can use SentOnBehalfOfName in non-Exchange scenarios, too, but 
the results may not be what you expect. Test for yourself before implementing 
on a large scale. 

3) If you're mainly concerned about replies to your message going to the 
correct place, add the desired reply address to the MailItem.ReplyRecipients 
collection. 

The third-party Redemption ( http://www.dimastr.com/redemption/ ) library 
adds two other solutions: 

4) Set an RFC822 header property, as described at 
http://www.dimastr.com/redemption/faq.htm#14

5) Set the RDOMail.Account property, as described at 
http://www.dimastr.com/redemption/rdo/RDOMail.htm
-- 
Sue Mosher, Outlook MVP
   Author of Microsoft Outlook 2007 Programming:
     Jumpstart for Power Users and Administrators
    http://www.outlookcode.com/article.aspx?id=54 

"Sue" wrote:

> Hi just in case you spot the missing '=' sign this doesn't work still...
> 
> "Sue" <sportybabesue@hotmail.co.uk> wrote in message 
> news:uqGZFvhBLHA.3880@TK2MSFTNGP04.phx.gbl...
> > Hi all
> >
> > I posted this last week but it seems MS deleted a load of its forums, 
> > including the VBA one I'd posted to :-(. So here goes again...
> >
> > From MS Access 2003, I have a routine in code that automates an email. I 
> > can autofill the To, cc, subject, body field etc but now I need to also 
> > send from a different user using the 'From' field. I tried adding this in 
> > the same way to my code using:
> >
> > .from
> >
> > but it seems this is not a supported method? I receive and Access error 
> > 438: Object does not support this property of method.
> >
> > Please can any one tell me if this is possible and if so how to do it? If 
> > I leave for the user to enter the from email address manually it is very 
> > easy for them to miss this and just hit send, which would result in it 
> > being addressed as themselves. It is crucial that this does not happen as 
> > we are sending the emails on behalf of a different company.
> >
> > Thanks for your help...
> >
> > snipped of the Code, if I rem the .from line this will work ok...
> >
> >        With objEmail
> >            .from "Me@test.com"
> >            .To = "SJH-" & dist
> >            .CC = "me@test.com"
> >            .BCC = "sue;fred;tom"
> >            .Subject = "Analysis Monthly Reports"
> >            .Body = "Test email please ignore... "
> >            .Attachments.Add strPath
> > 
> 
> 
> .
> 
0
Utf
6/7/2010 11:57:44 AM
Thanks I will use the other forum from now on...

Yes it is Outlook 2003 and we do use an Exchange Server. The other email 
address is a public folder though so not strictly a 'mailbox' - not sure if 
this changes things? It all works as desired manually, I have set the 
relevant send as permissions etc for those who need to send these messages 
and the replies are returned back to the public folder and copied to another 
mailbox.

I'd assumed there was no '.From' command when it failed, I just didn't know 
if there was a way round this. I will have a look at the command bar 
techniques you mentioned thanks, if all else fails the user will just have 
to enter the From field manually...



"Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message 
news:8E0B8187-F857-4573-AD03-80B90B7CE5A3@microsoft.com...
> In the future, you can use the Outlook for Developers forum at
> http://social.msdn.microsoft.com/Forums/en-US/outlookdev/threads for your
> Outlook coding questions.
>
> The object browser (F2 in VBA) is your friend: If you used it to look at 
> the
> MailItem object in the Outlook object model, you'd see that there is no 
> From
> property. That's the cause of your error.
>
> You didn't say what version of Outlook you're using, but I presume it's
> Outlook 2003.  That version provides no direct way to change the sender 
> for
> an outgoing message. These are known workarounds using native Outlook
> functionality:
>
> 1) If the user has Outlook 2002/3 and is not using WordMail as the editor,
> you set the sending account using CommandBars techniques. See
> http://www.outlookcode.com/codedetail.aspx?id=889 for sample code.
>
> 2) In an Exchange environment where you want to use another user's mailbox
> as the From address, set the MailItem.SentOnBehalfOfName property. If you 
> do
> not want the current user's name to appear in the message at all, the
> Exchange administrator must grant Send As permission on the other user's
> mailbox.
>
> Note that you can use SentOnBehalfOfName in non-Exchange scenarios, too, 
> but
> the results may not be what you expect. Test for yourself before 
> implementing
> on a large scale.
>
> 3) If you're mainly concerned about replies to your message going to the
> correct place, add the desired reply address to the 
> MailItem.ReplyRecipients
> collection.
>
> The third-party Redemption ( http://www.dimastr.com/redemption/ ) library
> adds two other solutions:
>
> 4) Set an RFC822 header property, as described at
> http://www.dimastr.com/redemption/faq.htm#14
>
> 5) Set the RDOMail.Account property, as described at
> http://www.dimastr.com/redemption/rdo/RDOMail.htm
> -- 
> Sue Mosher, Outlook MVP
>   Author of Microsoft Outlook 2007 Programming:
>     Jumpstart for Power Users and Administrators
>    http://www.outlookcode.com/article.aspx?id=54
>
> "Sue" wrote:
>
>> Hi just in case you spot the missing '=' sign this doesn't work still...
>>
>> "Sue" <sportybabesue@hotmail.co.uk> wrote in message
>> news:uqGZFvhBLHA.3880@TK2MSFTNGP04.phx.gbl...
>> > Hi all
>> >
>> > I posted this last week but it seems MS deleted a load of its forums,
>> > including the VBA one I'd posted to :-(. So here goes again...
>> >
>> > From MS Access 2003, I have a routine in code that automates an email. 
>> > I
>> > can autofill the To, cc, subject, body field etc but now I need to also
>> > send from a different user using the 'From' field. I tried adding this 
>> > in
>> > the same way to my code using:
>> >
>> > .from
>> >
>> > but it seems this is not a supported method? I receive and Access error
>> > 438: Object does not support this property of method.
>> >
>> > Please can any one tell me if this is possible and if so how to do it? 
>> > If
>> > I leave for the user to enter the from email address manually it is 
>> > very
>> > easy for them to miss this and just hit send, which would result in it
>> > being addressed as themselves. It is crucial that this does not happen 
>> > as
>> > we are sending the emails on behalf of a different company.
>> >
>> > Thanks for your help...
>> >
>> > snipped of the Code, if I rem the .from line this will work ok...
>> >
>> >        With objEmail
>> >            .from "Me@test.com"
>> >            .To = "SJH-" & dist
>> >            .CC = "me@test.com"
>> >            .BCC = "sue;fred;tom"
>> >            .Subject = "Analysis Monthly Reports"
>> >            .Body = "Test email please ignore... "
>> >            .Attachments.Add strPath
>> >
>>
>>
>> .
>> 


0
Sue
6/7/2010 2:01:44 PM
Reply:

Similar Artilces: