data type problem XL9
If I follow, effectively it does this (without the Val)
If "1" = 0 Then
again this works in both my XL97 & XL2k
Any missing references ?
Regards,
Peter T
"RB Smissaert" wrote in message
...
Actually the non-simplified code is:
'error he
If Val(ReadINIValueL(strINIPath, _
"Add-in behaviour", _
"F2 for load add-in")) = 0 Then
Function ReadINIValueL(ByVal strINIPath As String, _
ByVal strHeader As String, _
ByVal strKey As String) As String
Dim buf As String * 256
Dim Length As Long
If Len(Dir(strINIPath)) = 0 Then
ReadINIValueL = "<no file"
Exit Function
End If
Length = GetPrivateProfileString(strHeader, _
strKey, _
"<no value", _
buf, _
Len(buf), _
strINIPath)
ReadINIValueL = Left(buf, Length)
End Function
And the result of the function was "1" and not "<no file" or "<no value"
RBS
"Peter T" <peter_t@discussions wrote in message
...
Just to add the example works fine in both my XL97 and XL2000, as does
the
following in both versions
Dim n As Long
n = "123"
Regards,
Peter T
"Tom Ogilvy" wrote in message
...
I suspect the customer actually is experiencing this in xl97 (xl8). In
xl97,
you would get that error.
--
Regards,
Tom Ogilvy
"RB Smissaert" wrote:
Have come across a strange problem today with one of my customers.
In a .xla add-in I have in very much simplified code the following:
Sub test()
Dim l As Long
l = GiveString()
MsgBox l
End Sub
Function GiveString() As String
Dim s As String
s = "1"
GiveString = s
End Function
All this works fine on my 2 home PC's with XL11 and XL9.
With this one customer though in XL9 there is the error: Type
mismatch.
Why would this be if it runs fine on the home machine with XL9?
RBS
|