Variable uses an Automation type not supported in Visual Basic


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Variable uses an Automation type not supported in Visual Basic

  1. #1
    Willy Van den Driessche Guest

    Variable uses an Automation type not supported in Visual Basic


    I receive this error when I compile an activeX dll.
    The dll compiled before without any problem. Of course I modified the DLL.
    I added the following.
    A BAS module modPropPath)
    --------------------------
    Option Explicit

    Public Function CreatePropertyPath1(ByVal nPropertyID As Integer, ByVal objNext
    As clsTBXPropPath) As clsTBXPropPath
    Dim objResult As clsTBXPropPath

    Set objResult = New clsTBXPropPath
    With objResult
    .PropertyID = nPropertyID
    Set .NextList = objNext
    End With
    Set CreatePropertyPath1 = objResult
    End Function

    Public Sub DebugPrintPropPath(ByVal objPath As clsTBXPropPath)
    If objPath Is Nothing Then
    Debug.Print "Nothing"
    Else
    Debug.Print objPath.PropertyID; ", ";
    DebugPrintPropPath objPath.NextList
    End If
    End Sub


    a Class module (clsTBXPropPath) PublicNotCreatable:
    ---------------------------------------------------
    Private mProperty As Integer
    Private mNext As clsTBXPropPath

    ' propertyPaths are useful for focusing errors on properties
    ' they just store a linked list of integers

    Public Property Let PropertyID(ByVal nID As Integer)
    mProperty = nID
    End Property

    Public Property Get PropertyID() As Integer
    PropertyID = mProperty
    End Property

    Public Property Get NextList() As clsTBXPropPath
    Set NextList = mNext
    End Property

    Public Property Set NextList(ByVal objNext As clsTBXPropPath)
    Set mNext = objNext
    End Property

    Private Sub Class_Initialize()
    mProperty = -1
    Set mNext = Nothing
    End Sub

    Private Sub Class_Terminate()
    Set mNext = Nothing
    End Sub


    And, finally, a Global MultiUse Class :
    ---------------------------------------
    Option Explicit

    Public Function CreatePropertyPath1(ByVal nPropertyID As Integer, ByVal objNext
    As clsTBXPropPath) As clsTBXPropPath
    Set CreatePropertyPath1 = modPropPath.CreatePropertyPath1(nPropertyID,
    objNext)
    End Function

    Public Sub DebugPrintPropPath(ByVal objPath As clsTBXPropPath)
    modPropPath.DebugPrintPropPath objPath
    End Sub



    Of course, I use the class further in my other classes. I added it as a
    property to an existing classes (get/set).
    I use the module/GMU trick (same names, GMU routes to module) all the time
    to circumvent the notorious GMU bug which makes it unsuable (as a GMU) inside
    the defining DLL. That worked all the time, so I don't think this is the
    problem.
    I use VB6 service pack6 and the DLL uses only the 3 default VB libraries
    in its references). The DLL has no binary compatibility. Please help.



  2. #2
    Willy Van den Driessche Guest

    Re: Variable uses an Automation type not supported in Visual Basic


    I found the answer myself. I had also changed a sub from

    Public Function CreateBrokenRule(ByVal strBaseName As String, _
    ByVal strDetailName As String, _
    ByVal strErrorCode As String, _
    Optional ByVal eErrorLevel As eRuleErrorLevel
    = erelError, _
    Optional ByVal vTag As Variant) As clsRule

    to

    Public Function CreateBrokenRule(ByVal strBaseName As String, _
    ByVal strDetailName As String, _
    ByVal strErrorCode As String, _
    Optional ByVal eErrorLevel As eRuleErrorLevel
    = erelError, _
    Optional ByVal vTag As Variant = Null) As
    clsRule

    in a GMU class. For some reason VB didn't like that. Note that I have this
    procedure (exactly the second version) in a BAS module and VB doesn't complain.
    VB didn't even complain when I do a Ctrl-F5. It just complains when I try
    to build the target.
    The moral of the story. Make only minor changes and always compile. Beware
    of variants ?


    "Willy Van den Driessche" <Willy.van.den.driessche@skynet.be> wrote:
    >
    >I receive this error when I compile an activeX dll.
    >The dll compiled before without any problem. Of course I modified the DLL.
    >I added the following.
    >A BAS module modPropPath)
    >--------------------------
    >Option Explicit
    >
    >Public Function CreatePropertyPath1(ByVal nPropertyID As Integer, ByVal

    objNext
    >As clsTBXPropPath) As clsTBXPropPath
    > Dim objResult As clsTBXPropPath
    >
    > Set objResult = New clsTBXPropPath
    > With objResult
    > .PropertyID = nPropertyID
    > Set .NextList = objNext
    > End With
    > Set CreatePropertyPath1 = objResult
    >End Function
    >
    >Public Sub DebugPrintPropPath(ByVal objPath As clsTBXPropPath)
    > If objPath Is Nothing Then
    > Debug.Print "Nothing"
    > Else
    > Debug.Print objPath.PropertyID; ", ";
    > DebugPrintPropPath objPath.NextList
    > End If
    >End Sub
    >
    >
    >a Class module (clsTBXPropPath) PublicNotCreatable:
    >---------------------------------------------------
    >Private mProperty As Integer
    >Private mNext As clsTBXPropPath
    >
    >' propertyPaths are useful for focusing errors on properties
    >' they just store a linked list of integers
    >
    >Public Property Let PropertyID(ByVal nID As Integer)
    > mProperty = nID
    >End Property
    >
    >Public Property Get PropertyID() As Integer
    > PropertyID = mProperty
    >End Property
    >
    >Public Property Get NextList() As clsTBXPropPath
    > Set NextList = mNext
    >End Property
    >
    >Public Property Set NextList(ByVal objNext As clsTBXPropPath)
    > Set mNext = objNext
    >End Property
    >
    >Private Sub Class_Initialize()
    > mProperty = -1
    > Set mNext = Nothing
    >End Sub
    >
    >Private Sub Class_Terminate()
    > Set mNext = Nothing
    >End Sub
    >
    >
    >And, finally, a Global MultiUse Class :
    >---------------------------------------
    >Option Explicit
    >
    >Public Function CreatePropertyPath1(ByVal nPropertyID As Integer, ByVal

    objNext
    >As clsTBXPropPath) As clsTBXPropPath
    > Set CreatePropertyPath1 = modPropPath.CreatePropertyPath1(nPropertyID,
    >objNext)
    >End Function
    >
    >Public Sub DebugPrintPropPath(ByVal objPath As clsTBXPropPath)
    > modPropPath.DebugPrintPropPath objPath
    >End Sub
    >
    >
    >
    >Of course, I use the class further in my other classes. I added it as a
    >property to an existing classes (get/set).
    >I use the module/GMU trick (same names, GMU routes to module) all the time
    >to circumvent the notorious GMU bug which makes it unsuable (as a GMU) inside
    >the defining DLL. That worked all the time, so I don't think this is the
    >problem.
    >I use VB6 service pack6 and the DLL uses only the 3 default VB libraries
    >in its references). The DLL has no binary compatibility. Please help.
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center