I just started a project were I need to call dll functions from within excel.
More specifically I have created a custom dll in Visual Basic (visual studio 2005) with the following code:
Expand|Select|Wrap|Line Numbers
- Public Class main
- Public Function sayHi() As String
- Return ("Hello world\n")
- End Function
- End Class
Expand|Select|Wrap|Line Numbers
- Declare Function tellme Lib "c:\shipping_VB.dll" Alias "sayHi()" () As String
- Public Sub myClick()
- MsgBox tellme()
- End Sub
finally I tried to make a new VB (2005) project as bellow:
Expand|Select|Wrap|Line Numbers
- Public Class Form1
- Public Declare Function DeclareBeep Lib "kernel32" Alias "Beep" _
- (ByVal dwFreq As Integer, ByVal dwDuration As Integer) As Integer
- Declare Auto Function sayHi Lib "c:\shipping_VB.dll" () As String
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- MsgBox("hi")
- DeclareBeep(10000, 1000)
- MsgBox(sayHi())
- End Sub
- End Class
can anyone PLEASE tell me what I am doing wrong, because I am sure it's something really stupid that I can not see at the moment...