473,671 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual Basic (Studio 2005) DLL called from VBA for Excel (error 453)

1 New Member
hello and happy new year...
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
  1. Public Class main
  2.  
  3.     Public Function sayHi() As String
  4.         Return ("Hello world\n")
  5.     End Function
  6.  
  7. End Class
  8.  
then I try to call this from excel using
Expand|Select|Wrap|Line Numbers
  1. Declare Function tellme Lib "c:\shipping_VB.dll" Alias "sayHi()" () As String
  2.  
  3. Public Sub myClick()
  4.     MsgBox tellme()
  5. End Sub
  6.  
I also tried to change the alias to main.sayHi() and both these without the parenthesis...

finally I tried to make a new VB (2005) project as bellow:
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Public Declare Function DeclareBeep Lib "kernel32" Alias "Beep" _
  4.         (ByVal dwFreq As Integer, ByVal dwDuration As Integer) As Integer
  5.  
  6.     Declare Auto Function sayHi Lib "c:\shipping_VB.dll" () As String
  7.  
  8.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  9.         MsgBox("hi")
  10.         DeclareBeep(10000, 1000)
  11.         MsgBox(sayHi())
  12.     End Sub
  13. End Class
  14.  
sadly I get the first msgbox, I get the beep but I still get an 453 error on my own custom function!!! the application finds the dll, but not the function within it!
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...
Jan 10 '07 #1
0 2040

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2957
by: Omar | last post by:
Hi Developers, I am trying to access an Excel data file through a VB.Net application. I have the following code: =================================== VB.Net Code =================== Dim sSqlString = "" Dim rCount As Integer = 0 Dim sDataSet As New DataSet() sSqlString = "Select * From "
0
1511
by: Dr. Zharkov | last post by:
Hello. To see the graphics of technology DirectX 9.0 SDK Update - June 2005 in project Visual Basic, WindowsApplication1 from Visual Studio 2005 Beta 1, in file My Project, MyApplication.vb in a method: <Global.System.Diagnostics.DebuggerStepThrough()> _ Protected Overrides Sub OnCreateMainForm()
10
8197
by: Steve | last post by:
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied everything I can find on COM Interop and .NET. I've also tried many of the 'Walkthroughs' on the MSDN site relating to COM add-ins, .NET and Office XP but am unable to get even these working in Excel 2002 or Word 2002. I've installed the Office XP...
1
4815
by: JohnSmith | last post by:
I am working on a tuturial that i have for Visual basic.net ( for now ) I am working with Visual Studio 2005. I have been working on a code to change the text color by the name put into the text box. Visual Basic .Net code. Label2.ForeColor = Color.FromName(TextBox1.Text)
4
2155
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a problem. Can they not just post the fix. I see no reason to contact MS since I have most likely sent about 1500 dumps to them and I would think this would get their attention.
0
2551
by: bernhard.nowara | last post by:
Hello, I found a bug in Visual Basic used with Visual Studio Macros (Microsoft Visual Studio 2005 + SP1). Description: If I apply the simple Visual Basic statement ActiveDocument.Selection.Text = "//" + ActiveDocument.Selection.Text
3
1308
by: Amit | last post by:
Hello group, I"m new to COM Interop and Add-Ins. Today I was reading an article that says: "Use Visual Studio Tools for the Microsoft Office System to create a new Excel Workbook project in Visual Basic .NET or Microsoft Visual C#". I"m using Visual Studio 2002 and I don't see any project type for Excel !!!
11
2284
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I have seen the terms Visual Basic 2005 and VB.NET. It seems that sometimes they seem to be referring to the same thing but sometimes they are not. I also run into terms like VB9 and VB10.
2
3073
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following errors 1.Error 6 Cannot implicitly convert type 'mscomctl.Toolbar ' to 'mscomctl.Toolbar . An explicit conversion exists (are you missing a
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.