I'm trying to create trip scheduler template. On this template (towards the top) I've got a table with 7 columns for data:
Appointment Type
Name
Date
Start Time
End Time
Start Location
End Location
There are 2 header rows; one for the title and the other for the categories listed above. After that, there is one row with a drop-down control box in the first cell. I currently have a macro set to run on field exit. This macro makes a call to 1 of 3 user forms that collect collect data based on the selected drop-down value. This all works just fine.
I also have a button that runs another macro which adds another row at the bottom of the table and fills the first cell in the row with another drop-down control box (with the same 3 options as the other). This also works fine except I can't find how to apply the "run macro on exit" property (if it even exists).
Can anyone help me? Thanks in advance.
Code:
Appointment Type
Name
Date
Start Time
End Time
Start Location
End Location
There are 2 header rows; one for the title and the other for the categories listed above. After that, there is one row with a drop-down control box in the first cell. I currently have a macro set to run on field exit. This macro makes a call to 1 of 3 user forms that collect collect data based on the selected drop-down value. This all works just fine.
I also have a button that runs another macro which adds another row at the bottom of the table and fills the first cell in the row with another drop-down control box (with the same 3 options as the other). This also works fine except I can't find how to apply the "run macro on exit" property (if it even exists).
Can anyone help me? Thanks in advance.
Code:
Code:
Sub AddApt_Click()
' Add Appointment macro
'
With ActiveDocument
'Remove protection if protected
If .ProtectionType = wdAllowOnlyFormFields Then .Unprotect
With .Tables(1)
'Add new row on bottom
.Rows.Add
'Add appointment type drop down box
.Range.FormFields.Add _
Range:=.Rows.Last.Cells(1).Range, _
Type:=wdFieldFormDropDown
.Rows.Last.Range.FormFields(1).Name = "Appointment" & CStr(.Rows.Count - 2)
With .Rows.Last.Range.FormFields(1).DropDown.ListEntries
.Add Name:="Meeting"
.Add Name:="Flight"
.Add Name:="Hotel"
End With
End With
'Re-protect
.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True
End With
End Sub