Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Calendar has stopped working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dylan - 28 May 2008 11:07 GMT
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
Dylan - 28 May 2008 11:16 GMT
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.

> I have several userforms and each contain a calendar popup. They all worked
> perfectly until today. Now they have all stoppped working.
[quoted text clipped - 36 lines]
>
> 'Dylan
Dylan - 28 May 2008 12:49 GMT
Got it!

I had another macro, in Normal.dot, called Format

Phew!

> I have several userforms and each contain a calendar popup. They all worked
> perfectly until today. Now they have all stoppped working.
[quoted text clipped - 36 lines]
>
> 'Dylan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.