View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default data type problem XL9

Sorry, the actual code was causing the error was:

If ReadINIValueL(strINIPath, _
"Add-in behaviour", _
"F2 for load add-in") = 0 Then

So, without the Val. I had added the Val as a fix.
So, your example looks very similar and probably this is indeed an XL97
thing.

RBS


"Tom Ogilvy" wrote in message
...
This doesn't have any bearing on Bart's non-simplified code, but

I don't have xl97 handy to test, but try it this way. this works in
xl2003
but I believe it will raise typemismatch in xl97.

Sub test()

Dim i As Long
i = 1
if i = GiveString() then
msgbox "match"
else
MsgBox i
end if

End Sub


Function GiveString() As String

Dim s As String
s = "1"
GiveString = s

End Function

--
Regards,
Tom Ogilvy


"Peter T" wrote:

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