Userform - Cannot Find Project Or Library

snuggles79

New Member
Joined
Sep 25, 2006
Messages
8
Yesterday my code in excel was working perfectly and today I am getting a "Cannot Find Project Or Library" error message and it's highlighting the phrase "Format" in particular

The code is:

Code:
Private Sub contdate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    If Not IsDate(contdate) Then
        MsgBox "Input must be a date in the format: 'dd/mm/yyyy'"
        Cancel = True
    Else
        contdate = Format(contdate, "dd/mm/yyyy")
    End If
End Sub




Private Sub conttime_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    If Not IsDate(conttime) Then
        MsgBox "Input must be a time in the format: 'hh:mm'"
        Cancel = True
    Else
        conttime = Format(conttime, "hh:mm")
    End If
End Sub

Anybody know how to sort this problem out?

Thanks in advance
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
That's great and it now works perfectly - can you explain the logic behind having to do that all of a sudden though please and what it means exactly?
 
Upvote 0
Not sure why it would go all of a sudden, but presumably the compiler is looking for the Format method in eg the Forms library and not finding it. preceding by VBA tells it to look in the VBA library.

Richard
 
Upvote 0

Forum statistics

Threads
1,213,507
Messages
6,114,029
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top