I have been using many macros I wrote for various Out of Office messages I leave in Outlook 2007. We have recently upgraded to Exchange 2007 (finally!!) and now I can't find any info on how to set the Date and Time range and the font & font size settings for Out of Office messages via VBA. I have attached the code for the macro I use when leaving for the day.
Const PR_OOF_STATE = "http://schemas.microsoft.com/mapi/proptag/0x661D000B"
Dim olkIS As Outlook.Store
Dim olkPA As Outlook.PropertyAccessor
Dim olkOOFMessage As Outlook.StorageItem
Dim Text1, Text2, Text3, TextComma As String
TextComma = ", "
Text1 = "Thanks for your e-mail! "
Text2 = "My hours are 7:30 - 4:00 and I am gone for the rest of today, "
EndOfWeek = InputBox("Last day of the week? y/n", "Out of Office", "n")
If UCase(EndOfWeek) <> "Y" Then
Text3 = ". I will reply to your e-mail in the morning. If this is an urgent matter, please call 1234."
Text3 = ". I will reply to your e-mail Monday morning. If this is an urgent matter, please call 1234."
For Each olkIS In Session.Stores
If olkIS.ExchangeStoreType = olPrimaryExchangeMailbox Then
Set olkPA = olkIS.PropertyAccessor
olkPA.SetProperty PR_OOF_STATE, True
Set olkOOFMessage = Outlook.Session.GetDefaultFolder(olFolderInbox).GetStorage("IPM.Note.Rules.OofTemplate.Microsoft", olIdentifyByMessageClass)
olkOOFMessage.Body = Text1 & Chr$(13) & Chr$(13) & Text2 & WeekdayName(Weekday(Date)) & TextComma & Date & Text3
Set olkIS = Nothing
Set olkPA = Nothing
Set olkOOFMessage = Nothing