MS Excel VBA Meeting Request Code to Set Meeting to Property

OilEconomist

Active Member
Joined
Dec 26, 2016
Messages
439
Office Version
  1. 2019
Platform
  1. Windows
Hello and thanks in advance. I have written code that works which loops through a MS Excel Sheet to make MS Outlook Appointments and or Meeting Requests. It’s similar to something like what this thread discusses: Excel VBA - Creating Outlook Meeting (Send from designated email)

The one thing I would like to add is code to read in from this spreadsheet whether the appointment is Private or Not (Yes/No). What line of code what I would as I already tried .Private = Yes, which does not work? I’ve searched all over the internet, but could not find anything.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Do you know if .Private is valid method for this object, or are you just guessing? If it is, have you tried True instead of Yes (or False instead of No)
 
Upvote 0
Do you know if .Private is valid method for this object, or are you just guessing? If it is, have you tried True instead of Yes (or False instead of No)
Thanks @Engberg for your response. ".Private" is a guess by me. I tried setting it to "True" and that did not work.

I got it to work by using ".Sensitivity" and setting it to "olPrivate". See next line:

VBA Code:
.Sensitivity = olPrivate

I got to the final result by doing the following:

I modified my code a bit where whenever I was creating the meeting request, if I typed in ".", it would give me choices as such:

1720299415175.png


I then looked through to see if "Private" existed and it did not, so I looked through every choice and concluded that it could possibly be "Sensitivity". I set it to "Yes", "True", etc, but none of the aforementioned worked. I then did a google search and came across this post: What does Sensitivity of Personal mean on an Appointment in Outlook? which stated to set it to olPrivate. Bingo! It worked.

So my code looks something like this:

VBA Code:
Sub OL_Appointment()


    'Dimensions
     Dim OL_Appl As Outlook.Application
     Dim OL_Appt As Outlook.AppointmentItem



    'Create Outlook application
     Set OL_Appl = New Outlook.Application
     Set OL_Appt = OL_Appl.CreateItem(olAppointmentItem)
        
        

    'Create Appointment
     With OL_Appt
        .Subject = "Test"
        .Start = #7/7/2024 7:00:00 PM#
        .Duration = 90
        .Location = "Mars"
        .Importance = olImportanceHigh
        .ReminderMinutesBeforeStart = 15
        .Sensitivity = olPrivate 'Sets it to private
        .Display 'Remove this to just save it versus saving and displaying
     End With
        
        
        
    'Save the appointment
     OL_Appt.Save
        
        
    'Release
     Set OL_Appl = Nothing
     Set OL_Appt = Nothing


End Sub
 
Upvote 0
Solution
Good job, I couldn't find any documentation on it when I searched for it, glad you figured it out :)
 
Upvote 0
Good job, I couldn't find any documentation on it when I searched for it, glad you figured it out :)

Once again thanks for participating @Engberg because the nudge you gave me got me to not give up. I mean I have been searching for this for days!
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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