• Subject: Re: SendUsingAccount
  • Author: Graham Mayor
  • Date: 18 Feb 2010
  • References: 1 2 3 4 5
You will get such an error if you don't have the correct Outlook account
name?

Set OutAcct = OutNS.Accounts.Item("sendingaccount@domain.com")

Use the name displayed in your Outlook Tools > Accounts Settings list which
is probably not the e-mail address.

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



"JSOBERWE" <JSOBERWE@discussions.microsoft.com> wrote in message
news:0249D267-8EA2-4A39-8662-9A0B5AD1F648@microsoft.com...
> Right - I tried that before my 2nd post. It didn't work. To be sure, I
> tried
> it again after your post. That line then generates the following error:
> "Runtime error '5'. Invalid call procedure or argument."
>
> Thanks so much for helping me!
>
> Here's the modified code for clarity:
>
> Sub test()
>
> Set rng = Sheets("SharedRepIDs").Range("A1:L7")
>
> Set OutApp = CreateObject("Outlook.Application")
> OutApp.Session.Logon
> Set OutMail = OutApp.CreateItem(0)
>
> Dim OutAcct As Outlook.Account
> Set OutNS = OutApp.GetNamespace("MAPI")
> OutNS.Logon
> Set OutAcct = OutNS.Accounts.Item("sendingaccount@domain.com")
>
> 'On Error Resume Next
> With OutMail
>
> Set .SendUsingAccount = OutAcct
> .To = "toaccount@domain.com"
>
> .Subject = "Test"
> .HTMLBody = "Test"
> .Send
> End With
> On Error GoTo 0
>
> With Application
> .EnableEvents = True
> .ScreenUpdating = True
> End With
>
> Set OutMail = Nothing
> Set OutApp = Nothing
> End Sub
17 Feb 2010SendUsingAccount.JSOBERWE
17 Feb 2010\ Re: SendUsingAccount.Michael Bauer [MVP - ...
17 Feb 2010   \ Re: SendUsingAccount.JSOBERWE
18 Feb 2010      \ Re: SendUsingAccount.Michael Bauer [MVP - ...
18 Feb 2010         \ Re: SendUsingAccount.JSOBERWE
18 Feb 2010            \ Re: SendUsingAccount.Graham Mayor
18 Feb 2010               \ Re: SendUsingAccount.Ken Slovak - [MVP - O...
18 Feb 2010                  |- Re: SendUsingAccount.JSOBERWE
18 Feb 2010                  |  |- Re: SendUsingAccount.JSOBERWE
18 Feb 2010                  |  |  \ Re: SendUsingAccount.Ken Slovak - [MVP - O...
18 Feb 2010                  |  \ Re: SendUsingAccount.JSOBERWE
18 Feb 2010                  |     |- Re: SendUsingAccount.Michael Bauer [MVP - ...
18 Feb 2010                  |     \ Re: SendUsingAccount.JSOBERWE
18 Feb 2010                  |        \ Re: SendUsingAccount.JSOBERWE
18 Feb 2010                  \ Re: SendUsingAccount.Michael Bauer [MVP - ...
18 Feb 2010                     \ Re: SendUsingAccount.Dmitry Streblechenko
19 Feb 2010                        \ Re: SendUsingAccount.Michael Bauer [MVP - ...
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)