¿Cómo cerrar un elemento de cita de Outlook usando vbscript?
Frecuentes
Visto 515 equipos
0
Tengo un formulario personalizado en el que quiero tomar el control total de la cita Elemento que está abierto. Cuando el usuario hace clic en el botón, quiero que se guarden el elemento y los datos (que tengo), pero quiero que la ventana se cierre también...
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
Soy EXTREMADAMENTE nuevo en VBScript pero la función .close simplemente no funciona, ¿qué me estoy perdiendo?
1 Respuestas
0
No parece del VBA que se haya mostrado nada, pero
myOutlook.Quit
Set myOutlook = Nothing
debe cerrar Outlook si está abierto.
respondido 27 nov., 14:21
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas vbscript outlook-2007 appointment or haz tu propia pregunta.