VB6 Run time error '13' Type Mismatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    VB6 Run time error '13' Type Mismatch

    HI all ,


    I am using Windows 2000 OS for out server . We use a VB tool to deploy all the COM applications. In that , this is a snippet of code that is failing :

    Code:
     
    Option Explicit
    Dim ComAdm As New COMAdmin.COMAdminCatalog
    Set ComAdm = CreateObject("COMAdmin.COMAdminCatalog")
    At this point , the program just throws an exception "Type mismatch" and comes out .

    I have searched google for this but cant seem to find the appropriate answer .

    Any ideas ?

    Regards ,

    Rhitam
  • shrimant
    New Member
    • Sep 2007
    • 48

    #2
    Originally posted by rhitam30111985
    HI all ,


    I am using Windows 2000 OS for out server . We use a VB tool to deploy all the COM applications. In that , this is a snippet of code that is failing :

    Code:
     
    Option Explicit
    Dim ComAdm As New COMAdmin.COMAdminCatalog
    Set ComAdm = CreateObject("COMAdmin.COMAdminCatalog")
    At this point , the program just throws an exception "Type mismatch" and comes out .

    I have searched google for this but cant seem to find the appropriate answer .

    Any ideas ?

    Regards ,

    Rhitam
    Either Use
    Dim ComAdm As New COMAdmin.COMAdm inCatalog
    Or
    Set ComAdm = CreateObject("C OMAdmin.COMAdmi nCatalog")

    You cannot use both on the same variable, the first statement is an early binding and the second statement is an late binding, since the same variable is early binded, you cannot use is for late.

    Comment

    • rhitam30111985
      New Member
      • Aug 2007
      • 112

      #3
      Hi ,

      Sorry to post to this thread so late but this is the way it has been instructed to use in the MSDN site :



      Is it because of the option explicit statement on the top or does the "new" keyword make a difference?

      Comment

      Working...