Error when calling vb dll subroutine from excel vba

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Spence5
    New Member
    • Aug 2008
    • 2

    Error when calling vb dll subroutine from excel vba

    I've created the following dll in vb 2008 which doesn't offer an easy com template/project, thus I used project type "Class Library".
    Code:
    Public Interface IDemo
        Sub doSomething()
    End Interface
    Public Class implementIDemo
        Implements IDemo
        Dim varAsInterface As IDemo = New implementIDemo()
        Dim varAsClass As implementIDemo = New implementIDemo()
        Private Sub doSomething() Implements IDemo.doSomething
        MsgBox("Hello")
        End Sub
    End Class
    I then used tlbexp.exe, gacutil.exe, regasm,exe, and sn.exe so that the
    "doSomethin g" sub routine could be accessed/called from an excel vba (by
    first referencing the tlb file).

    My excel vba is as follows:

    Code:
    Private moTemp As mydll.IDemo
    
    Sub trial()
    moTemp.doSomething
    End Sub
    Excel VBA seems to recognize class and subfunction as I'm typing them,
    but when I run the "trial" macro I get the following error:

    "Run-time error '91': Object variable or With block variable not set"

    Have I done everything I need to in vb, and if so does anyone know if the call from excel vba is correct?

    Thanks in advance,
    Last edited by Curtis Rutland; Aug 6 '08, 07:13 PM. Reason: Added Code Tags - Please use the # button
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Please use [CODE] tags (the # button on the text editor) when posting in this forum.

    Please read the Posting Guidelines

    MODERATOR

    Comment

    • Spence5
      New Member
      • Aug 2008
      • 2

      #3
      I may have possibly posted this in the wrong forum (judging from the fact that nobody seems to have any knowledge in this area). I'll try elsewhere.

      Thanks anyways,

      Comment

      Working...