Excel VBA - 使用东部时区创建Outlook约会

时间:2012-09-21 23:46:01

标签: excel-vba vba excel

我有一个Excel宏创建一个Outlook约会。除了我需要将时区设置为“东方”之外,我可以使一切正常。我的一些同事住在其他时区,我想确保在正确的时间为他们设定预约。这是我目前的代码。如何将时区设置为东部(美国和加拿大)?

Set objOL = CreateObject("Outlook.Application")
        Set objItem = objOL.CreateItem(1)
        With objItem
            .StartTimeZone = "Eastern"
            .Start = Range("B4").Text & " " & Range("C4").Text
            .End = Range("B4").Text & " " & Range("D4").Text
            .Body = "Centra Link: " & Range("K4") & vbCrLf & vbCrLf & " Phone: " & Range("I4") & vbCrLf & vbCrLf & "Lead facilitator:  " & Range("E4") & vbCrLf & "Co-facilitator:  " & Range("F4") & vbCrLf & vbCrLf & Range("MISC_HEADER") & ":  " & Range("H4")

            .Location = Range("I4") & ", Leader Code: " & Range("J4")
            .alldayevent = False
            .Subject = Range("A4")
            .ReminderMinutesBeforeStart = 30
            .ReminderSet = True
            .Save
        End With
Set objItem = Nothing
Set objOL = Nothing
MsgBox "An appointment has been created for " & Range("A4") & " on " & Range("B4"), vbOKOnly, "Calendar Appointment"

1 个答案:

答案 0 :(得分:0)

说起来并不容易

.StartTimeTone = "Eastern"

看这里:http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._appointmentitem.starttimezone.aspx

你看,你必须创建一个TimeZone对象,就像这里

一样

How to Modify Properties (Time Zone) of Recurring Appointments in Outlook 2010 VBA

看看siddharth溃败的衣服。