【问题标题】:how to close an outlook appointmentItem using vbscript?如何使用 vbscript 关闭 Outlook 约会项目?
【发布时间】:2014-10-07 13:08:42
【问题描述】:

我有一个自定义表单,我想完全控制打开的约会项,当用户单击按钮时,我想要保存项目和数据(我有),但我想要窗口也关闭...

const olAppointmentItem = 9
Sub btn_create_Click()
MsgBox " wtf!!"

'get aplpication context
Dim myOutlook 
Set myOutlook = CreateObject("Outlook.Application")

'get shell access
Dim objShell
Set objShell = CreateObject("Shell.Application")

'get the namespace for access to shipping folder
Dim myNameSpace 
Set myNameSpace = myOutlook.GetNamespace("MAPI").GetDefaultFolder(9)

'get the location of the shipping folder
Dim myFolder
Set myFolder = myNameSpace.Parent
Set mySharedFolder= myNameSpace.Parent.Folders("Shipping")


' Create a new appointment.
Set olAppt = mySharedFolder.Items.Add  

'declare vars to pull from the form
Set oPage = Item.GetInspector.ModifiedFormPages
Set ship_company = oPage("Shipping").Controls("tb_CompanyName")
Set ship_date = oPage("Shipping").Controls("tb_shipDate")
Set ship_address = oPage("Shipping").Controls("tb_address")
Set ship_freighter = oPage("Shipping").Controls("tb_freighter")
Set ship_truck_type = oPage("Shipping").Controls("tb_truckType")
'TODO : need to figure out way for bv numbers because of multiline

'split the date value so it plays nice
Dim temp
temp = ship_date.text
Dim realDate
realDate = split(ship_date," ",2)


' Setup other appointment information...
With olAppt  
'   .Start = #10/4/2014 9:00 PM#
.Start = realDate(1)
  .Duration = 0
  .Subject = "Meeting to discuss plans..."
  .Body = "Meeting with fRANK    to discuss plans."
  .Location = "Home Office"
  .ReminderMinutesBeforeStart = 0
  .ReminderSet = false
.Save   

End With


'Save and close Appointment...
olAppt.Close (olSave)

Set myOutlook = Nothing
MsgBox "Done!"

end Sub

我对 VBScript 非常陌生,但 .close 函数不起作用,我错过了什么?

【问题讨论】:

    标签: vbscript outlook-2007 appointment


    【解决方案1】:

    从 VBA 中似乎没有显示任何内容,但是

    myOutlook.Quit
    Set myOutlook = Nothing
    

    如果 Outlook 已打开,则应关闭它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-31
      相关资源
      最近更新 更多