Calendar has stopped working

D

Dylan

I have several userforms and each contain a calendar popup. They all worked
perfectly until today. Now they have all stoppped working.

The problem appears at line 16 when the word "Format" appears highlighted in
blue and an error message appears stating "Compile error - wrong number of
arguments or invalid property assignment"

my calendar control is called ctrCal and my userform is called frmCalendar

Private Sub ctrlCal_Click() 'Control Name
Dim rng As Range
Dim bProtect as Boolean
Set rng = Selection.Range

On Error Resume Next

'Unprotect
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If

'If rng.Columns = 2 Then
With rng.Cells(1)
.Range.FormFields(1).Result = Format(ctrlCal.Value, "dd MMM yyyy")
End With

Unload Me

ActiveDocument.Tables(4).Range.FormFields("txtHidden").Select

'Reprotect the document.
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If

End Sub

'Dylan
 
D

Dylan

Additional Info:

I call the calendar using a macro called InsCalendar which I call from the
run macro on entry field of the textform field options.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top