• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Send Mail Using Different Account (Error 91 Object Variable or with block Variable not set)

Amol lad

New Member
Hi
My name is Amol.

i am trying to send some bulk mails using another profile in my outlook but i am getting an error like Error 91 Object Variable or with block Variable not set).

I am using outlook 2013 connected to Microsoft Exchange server in my office Pc.

Also added outlook library to my Vba.

Please check the attached file.

Please help me what to do is there any other code to do so.
 

Attachments

Marc L

Excel Ninja
Hi !​
Restart from the blue banner before to log in or from​
 

Amol lad

New Member
Code:
Sub sendmail_from_Other_Account()

Dim ol As outlook.Application
Dim mi As outlook.MailItem

Set OutlookApp CreateObject ("Outlook.application")
Set AM = OutlookApp.CreateItem (0)

AM.Display
AM.Subject ="Test"
AM.To = "abc@gmail.com"
AM.Body = "Hi"

AM.SendusingAccount = ol.Session.Accounts ("Retailsalesmis@motilaloswal.com")

End Sub
 
Last edited:

Amol lad

New Member
@vletm

I have also tried the link which you have given but it gives me the same error message.

Got the code on youtube:-


I think this code will not work if i am connected to Microsoft Exchange Server.
 

Amol lad

New Member
@vlletm

i guess the issue is i am using Microsoft Exchange thats why its not working.

There is no difference in the code which i am using, The same code works with my home PC.
 

vletm

Excel Ninja
Amol lad
... then if You have to use Microsoft Exchange, You should work with Your home PC.
I won't even test to run it.
... and You didn't reply to my question.
I do not have more ideas - good luck.
 
Top