Invite Attendies to display in Outlook Macro

Jay3

Board Regular
Joined
Jul 3, 2009
Messages
237
Hi,

Can someone help me with the following code. I need to understand why my invite attendees box would display when I run the following macro.

Code:
Option Explicit
Public Sub Create_Reminder(ByVal aRow As Long)
  Dim oApp As Object ' Outlook.Application
  Dim oNameSpace As Object  ' Namespace
  Dim oItem As Object  ' AppointmentItem
  Const olImportanceNormal As Integer = 1
  Const olAppointmentItem As Integer = 1
  Dim iLastRow As Long
  Dim irow As Long
  Dim wsData As Worksheet
  Dim colCB As Object 'Office.CommandBars
  Dim oInsp As Object 'Outlook.inspector
  
    
  Set wsData = ThisWorkbook.Sheets("Sheet1")
  
  On Error Resume Next
  ' check if Outlook is running
  Set oApp = GetObject("Outlook.Application")
  If Err <> 0 Then
    'if not running, start it
    Set oApp = CreateObject("Outlook.Application")
  End If
  
  Set oNameSpace = oApp.GetNamespace("MAPI")
  
  Set oItem = oApp.CreateItem(olAppointmentItem)
  With oItem
    .Subject = wsData.Range("C" & aRow).Value
    .Body = "Originator: " & wsData.Range("B" & aRow).Value & vbCrLf _
          & "Request: " & wsData.Range("D" & aRow).Value & vbCrLf _
          & "Created: " & Format(Now(), "dd/mm/yyyy hh:nn:ss") & vbCrLf
    .Start = wsData.Range("E" & aRow).Value + TimeValue("09:00:00")
    .Duration = "00:00"
    
    .AllDayEvent = True
    .Importance = olImportanceNormal
    .Location = "*** Location goes here ***"
    
    .ReminderSet = True
    .ReminderMinutesBeforeStart = 24 * 60 ' assume reminder is 24 hours before
    .ReminderPlaySound = True
    .ReminderSoundFile = "C:\Windows\Media\Ding.wav"
 
    .Recipients.Add ([EMAIL="Someone@somewhere.co.uk"]Someone@somewhere.co.uk[/EMAIL])
    
    Set oInsp = oItem.GetInspector
    Set colCB = oInsp.CommanBars
    colCB.ExecuteMso ("InviteAttendees")
    
    .Display   'or use .Send
    
  
  End With
    
  Set oApp = Nothing
  Set oNameSpace = Nothing
  Set oItem = Nothing
  Exit Sub
  
End Sub

This is the code that should display the "Invite Attendees" box.

Code:
  Set oInsp = oItem.GetInspector
    Set colCB = oInsp.CommanBars
    colCB.ExecuteMso ("InviteAttendees")

but it doesn't seem to be working.

Can anyone help?

Thanks,
Jay3:biggrin:
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
It worked for me when I added a valid e-mail address here

Code:
.Recipients.Add "VoG@work.com"
 
Upvote 0
Could it be related to the actual settings in outlook itself, because it still isn't working for me?

Thanks,
Jay3
 
Upvote 0
Sorry, I don't know. Have you tried sending the invitation to yourself? That is what I did to test.
 
Upvote 0
Strange... it worked at home last night but it doesn't work today at work... :(

(Outlook 2007 at both locations.)
 
Last edited:
Upvote 0
Strange... it worked at home last night but it doesn't work today at work... :(

(Outlook 2007 at both locations.)

I tested "at work" (something of a euphemism these days :)) using Excel 2000 and Outlook 2003 (don't ask!).
 
Upvote 0
Jay3, rearrange the commands so the code to display the invitees is after the code to display the message - this way round:-<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
Code:
[FONT=Courier New]      .Display<o:p></o:p>[/FONT]
[FONT=Courier New]      Set oInsp = oItem.GetInspector<o:p></o:p>[/FONT]
[FONT=Courier New]      Set colCB = oInsp.CommandBars<o:p></o:p>[/FONT]
[FONT=Courier New]      colCB.ExecuteMso ("InviteAttendees")<o:p></o:p>[/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

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