Can someone tell me what this means?

  • Thread starter Thread starter DennisE
  • Start date Start date
D

DennisE

I've got the usual references to Excel and VBA in Tools->References,
but to play it safe I replaced my Left( ), Right( ), Mid( ), Chr( ), Val( ),
and CVar( ) function calls by VBA.Left( ), ..., VBA.CVar( ) and all
went well. However, when I replaced the Len( ) function call where
it appeared in my code with VBA.Len( ) and then ran my program,
execution stopped at the occurrance of one of those lines of code
and displayed the following error message:

"Compile error: Ony user-defined types in public object modules can
be coerced to or from a variant or passed to late-bound functions"

Can anyone tell me what this means in plain English?

-- Dennis Eisen
 
Dennis,

Sounds like if you're modifying Left, Right etc.. to VBA.Left then you may
have some broken references.
Check Tools | References for MISSING:
But that's unrelated to your problem...

I've had the error message before. I think it had something to do with a
trying to convert a User Defined Type to a Variant.

This example gives the same error, which can be fixed by declaring var as
mytype:

Type mytype
teststring As String
End Type

Sub test()
Dim var As Variant, udt As mytype

var = udt
End Sub


Rob
 
Back
Top