error -2147024894 (80070002) Automation Error RRS feed

  • Question

  • I am trying to add few "dlls" created using "c#" into registry.
    I use "regasm" utility from windows command prompt as follows (executed in with admin access)

    "C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm /codebase /tlb .\somedir\Sample.dll "

    Command prompt said above registration is successful. 

    RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed onthe same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
    Types registered successfully
    Assembly exported to C:\<Path>\Sample.tlb and the type library was registered successfully.

    This "Sample.dll" i am loading because of below VBA code i use in my excel. 
    Sub SomeFunc()
        'Below method is created in c#. Registered DLL is reference here
        Dim somelib As someClass

        'Instance creation using CreateObject
        Set somelib = New someClass
    End Sub

    When the above Excel-VBA code is executed it throws error saying "someClass" cannot be referred. 

    error -2147024894 (80070002) Automation Error
    The system cannot find the file specified

    Same has been followed in some other PC. No error in excel code. 

    I suspect the DLL is not properly registered in registry. 
    Not sure how "regASM" result displayed as success. 

    In VBE, i checked by going to Tools -> References also to check whether the DLL is checked olr not. 
    When i access the above setting, it asked for password. 
    After entering correct password only, it has opened the dialog box. 
    Does this password prevents to access dll during execution. 
    I dont think so because in some other PCs its working well. 

    Please guide me how can i know DLL registration is really success or not ? 

    Please bare, i don't know who implemented the dll. I am least bothered to know the implementation. I received it and using. Thats it.

    Thursday, August 27, 2020 2:45 AM

All replies

  • The path provided to regasm was a relative path - ".\somedir\Sample.dll "

    Re-register the dll by providing the fully qualifed path to the dll in the regasm command.

    For example, "C:\dir1\dir2\Sample.dll"

    Thursday, August 27, 2020 11:13 AM
  • @ RLWA32 Thanks for having look on this.. I tried by giving the full path. Still facing same issue. FYI, same command is working properly in other PCs. 
    Friday, August 28, 2020 12:41 AM
  • Hi Vijayendran1924,

    Since your code is related to VBA, you can also consider posting your question in Visual Basic for Applications (VBA) forum.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 28, 2020 9:38 AM