Outlook meeting sent on behalf of

aryanaveen

Board Regular
Joined
Jan 5, 2015
Messages
96
HI All

Please help me with below code

I have below code which is working fine without "SentOnBehalfOfName". the code setups a meeting invite from my default mailbox. I want to setup invite from a specific mailbox for which I have access but when I use "SentOnBehalfOfName" I get run time error 438, object doesn't support this property or method. can someone please help me with this

Sub Setupinvite()
Dim OutApp As Object
Dim Outmail As Object
Dim cell As Range

Application.ScreenUpdating = True
Set OutApp = CreateObject("Outlook.Application")
Set Outmail = OutApp.CreateItem(1)
Range("B16").Font.Bold = True

With Outmail
.SentOnBehalfOfName = "ABC@ABC.com" --------------------------This is where I am getting run time error, without this line macro setups meeting with my default ID
.MeetingStatus = olMeeting
.RequiredAttendees = Range("B2").Value
.Subject = Range("B3").Value
'.BodyFormat = olFormatRichText
.Start = Range("B5").Value
.Location = "Skype call-Internal Note-"
.Duration = 60 ' 1 hour meeting
.BusyStatus = 2 ' set as free
.ReminderSet = True 'reminder set
.ReminderMinutesBeforeStart = "15" 'reminder 2 weeks before
.Display
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,804
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
Hi.
.SentOnBehalfOfName is not supported for the appointment object.
Try using
VBA Code:
  .SendUsingAccount = OutApp.Session.Accounts.Item("abc@abc.com")
Also, instead of the account name, you can use the index 1, 2, etc.
 

aryanaveen

Board Regular
Joined
Jan 5, 2015
Messages
96
Thank you for your response ZVI,

I tried this, I have put my functional mailbox id with in accounts.item however the invites are still getting generated from my personal mail id
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,804
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
It works on my testing.
What do you see after .Display in the [From] field of the displayed appointment before sending?
Test the code with index 1, 2 ...
Rich (BB code):
.SendUsingAccount = OutApp.Session.Accounts.Item(2)
 

aryanaveen

Board Regular
Joined
Jan 5, 2015
Messages
96

ADVERTISEMENT

I tried with index, when I put 1 the invite will be generated with my personal ID, when I use 2 the macro throws an error. under my account settings I have only 1 account(personal Id), However I have 2 mailboxes in the outlook
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,804
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
May be the 2nd one is a hared account which has some limitations.
 
Last edited:

aryanaveen

Board Regular
Joined
Jan 5, 2015
Messages
96
exactly ZVI, its a shared mailbox, is it possible to modify the code to setup invites from shared mailbox. I can setup invites from shared mailbox manually but unable to do that through macro
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,804
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
The problem is not code depended.

Probably some settings are required in the Active Directory or/and in a department account for that shared mailbox.
But don't know which are exactly - have no experiance with a shared account.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,832
Messages
5,598,361
Members
414,233
Latest member
WolverineNurse

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top