views:

74

answers:

2

Hello, I'm using VB 6.0 and it gives me:

"Compile Error: Can't Find Project or Library"

in this sub:

Private Sub MDITimer_Timer()
    Dim textStr As String
    textStr = Format(Now, "dd-mm-yyyy hh:mm:ss")
    StatusBar.Panels(1).Text = textStr
End Sub

I made it like this and the error still was in the Format function (so it is not a StatusBar problem).

Can you tell me what is the Reference that we have to add to use the Format function please. Or if a Reference is not needed, what do we have to do to make this work? Tks in advance!

+2  A: 

Problem's more likely to be the StatusBar (in the Microsoft Windows Common Controls, MSCOMCTL.ocx). Format is built into the VB6 language, you shouldn't need any reference at all.


EDIT Format is in VBA.Strings. I think this is in the "Visual Basic for Applications" reference, MSVBVM60.dll. I thought the VB6 IDE prevented you from unticking the reference.

MarkJ
You are right m8. The problem must lies elsewhere.
aF
+1  A: 

You probably overloaded Format() with a declaration of the same name. Have you tried calling VBA.Format() instead?

You should also use Format$() to avoid the unnecessary overhead of working with the Variant result Format() returns.

Bob Riemersma
It was exactly this :Palthought I've solved the problem last week you've the better answer ^^
aF