- Joined
- Mar 29, 2010
- Messages
- 1
- Reaction score
- 0
I have an appointment that has a custom form attached to it called Transportation Form or P.2.
When a user is in custom form or P.2, upon cliking macro shortcut, some data fields will come over to first tab which is a regular appointment with subject, date and etc.
Not sure how to copy between different tabs within the same appointment. I get an error -2147024809?
Error is on Set ctrl = Application.ActiveInspector.........
Any help would be greatly appreciated!
here is my code:
Sub FormtoAppt()
Dim Subject As String
Dim objAppointment As AppointmentItem
Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
Set myItem = myFolder.Items.Add("IPM.Appointment.Formv1")
Dim objAppt As AppointmentItem
Dim ctrl As Object
Dim ctrl2 As Object
On Error GoTo ErrorCode
If Application.ActiveInspector.CurrentItem.Class = olAppointment Then
Set objAppointment = Application.ActiveInspector.CurrentItem
Set ctrl = Application.ActiveInspector.ModifiedFormPages("Transportation Form").Controls("DestinationandAddr")
Set ctrl2 = Application.ActiveInspector.ModifiedFormPages("Appointment").Controls("objAppt.Body")
ctrl2 = ctrl
Else
MsgBox Prompt:="Please open Appointment"
End If
Exit Sub
ErrorCode:
If Err.Number = 91 Then
MsgBox Prompt:="Appointment must be open"
Else
MsgBox Prompt:="Gen Error!"
End If
End Sub
When a user is in custom form or P.2, upon cliking macro shortcut, some data fields will come over to first tab which is a regular appointment with subject, date and etc.
Not sure how to copy between different tabs within the same appointment. I get an error -2147024809?
Error is on Set ctrl = Application.ActiveInspector.........
Any help would be greatly appreciated!
here is my code:
Sub FormtoAppt()
Dim Subject As String
Dim objAppointment As AppointmentItem
Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
Set myItem = myFolder.Items.Add("IPM.Appointment.Formv1")
Dim objAppt As AppointmentItem
Dim ctrl As Object
Dim ctrl2 As Object
On Error GoTo ErrorCode
If Application.ActiveInspector.CurrentItem.Class = olAppointment Then
Set objAppointment = Application.ActiveInspector.CurrentItem
Set ctrl = Application.ActiveInspector.ModifiedFormPages("Transportation Form").Controls("DestinationandAddr")
Set ctrl2 = Application.ActiveInspector.ModifiedFormPages("Appointment").Controls("objAppt.Body")
ctrl2 = ctrl
Else
MsgBox Prompt:="Please open Appointment"
End If
Exit Sub
ErrorCode:
If Err.Number = 91 Then
MsgBox Prompt:="Appointment must be open"
Else
MsgBox Prompt:="Gen Error!"
End If
End Sub