Greg
08-10-2007, 10:18 PM
Hi all,
Somewhere in this forum I found an active X button and popup calendar which I have used successfully in my document.
I now wish to use the Calendar to insert different dates in 2 places of the document.
I have created 2 command buttons cmdDate and cmdDate2 and each of them will bring up the calendar but I cant get the second button to fill in the second bookmark.
I feel that the following code needs modification but my attempts so far have been unsuccessful.
Can anyone help?
[Option Explicit
Private Sub cal_Click()
Dim szDate As String
'Chr$(160) is a protected space, so that the Date stays together on a line
szDate = Format(cal.Value, "d" & Chr$(160) & "mmmm" & Chr$(160) & "yyyy")
ActiveDocument.FormFields("txtCourseDate").Result = szDate
End Sub
Private Sub cal_LostFocus()
cal.Height = 0.5
End Sub
Private Sub cmdDate_Click()
DisplayCalendar
End Sub
Private Sub cmdDate2_Click()
DisplayCalendar2
End Sub
Sub CommandButton1_Click()
Dim oField As Word.Field
For Each oField In ActiveDocument.Fields()
oField.Update
Next
End Sub
]
Somewhere in this forum I found an active X button and popup calendar which I have used successfully in my document.
I now wish to use the Calendar to insert different dates in 2 places of the document.
I have created 2 command buttons cmdDate and cmdDate2 and each of them will bring up the calendar but I cant get the second button to fill in the second bookmark.
I feel that the following code needs modification but my attempts so far have been unsuccessful.
Can anyone help?
[Option Explicit
Private Sub cal_Click()
Dim szDate As String
'Chr$(160) is a protected space, so that the Date stays together on a line
szDate = Format(cal.Value, "d" & Chr$(160) & "mmmm" & Chr$(160) & "yyyy")
ActiveDocument.FormFields("txtCourseDate").Result = szDate
End Sub
Private Sub cal_LostFocus()
cal.Height = 0.5
End Sub
Private Sub cmdDate_Click()
DisplayCalendar
End Sub
Private Sub cmdDate2_Click()
DisplayCalendar2
End Sub
Sub CommandButton1_Click()
Dim oField As Word.Field
For Each oField In ActiveDocument.Fields()
oField.Update
Next
End Sub
]