Outlook meeting sent on behalf of

aryanaveen

Board Regular
Joined
Jan 5, 2015
Messages
104
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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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.
 
Upvote 0
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
 
Upvote 0
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)
 
Upvote 0
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
 
Upvote 0
May be the 2nd one is a hared account which has some limitations.
 
Last edited:
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,479
Members
448,967
Latest member
visheshkotha

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
Back
Top