Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default DLL Entry Points

Hi Everybody

I am trying to use a procedure from a dll and have used the Declare
Statement to reference to it, but I get a Run-time error €˜453: Cant find
DLL entry point.

Can anybody explain about DLL entry points?

Many thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default DLL Entry Points

DLL entry points are the "directory listing" of a DLL. without it the
external programs cannot investigate the DLL, although programmers with
the right docs could access the functions by number(notr by name).

VBA only allows access to DLL by name. the name of the DLL function
probably is not found so maybe misspelled, or maybe the wrong DLL is
called

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default DLL Entry Points

Thanks for your reply DM Unseen

This is the code used in VB6 to create the dll.

Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
On Error Resume Next
AddInInst.object = Me
End Sub

Private Sub AddInMsg()
MsgBox "This Message is from a dll addin"
End Sub

And this bit of code in VBA to call it

Private Declare Sub AddInMsg Lib "MySubAddIn.dll" ()

Private Sub CommandButton2_Click()
Call AddInMsg
End Sub

Any suggestions why its not found?

Many thanks


"DM Unseen" wrote:

DLL entry points are the "directory listing" of a DLL. without it the
external programs cannot investigate the DLL, although programmers with
the right docs could access the functions by number(notr by name).

VBA only allows access to DLL by name. the name of the DLL function
probably is not found so maybe misspelled, or maybe the wrong DLL is
called


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default DLL Entry Points

Is this a VB dll that is actually implementing a COM/ActiveX component?

Those are not real WInAPI DLL's but ActiveX DLL's. You cannot access
them through a declare, you need to add a reference to them!

VBA editor(ALT-F11) Tools-references-browse- select dll

BTW functions need to be public in VB to be visible as methods in VBA!

DM Unseen

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default DLL Entry Points

Hi DM Unseen

I am a bit out of my depth with this but trying my best. I believe that it
a VB dll implementing a COM/ActiveX component, I have tried putting the
reference as you said and change the procedure to Public, but the same error.

Want I what to do is write my procedures in VB6 and be able to write a bit
of VBA code to call them. Is there a better way I could go about it?

Many thanks


"DM Unseen" wrote:

Is this a VB dll that is actually implementing a COM/ActiveX component?

Those are not real WInAPI DLL's but ActiveX DLL's. You cannot access
them through a declare, you need to add a reference to them!

VBA editor(ALT-F11) Tools-references-browse- select dll

BTW functions need to be public in VB to be visible as methods in VBA!

DM Unseen




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default DLL Entry Points

A VB COM/ActiveX component is the best option.

My guess is that you are not just creating any COM/ActiveX component,
but actually an Office COM Addin. For a COM addin you can access it
thru

Applications.Commandins("Myaddin").Object.AddInMsg


Note the declare is not required. Also realise that if you do not need
the COM callback functionality (i.e. you just want a VB library
accessible from VBA) a normal ActiveX will do.

ActveX componenets are objects within VBA just like e.g. the Office
Object library, they are Com libraries that contain objects that need
to be instantiated. After that you can access their methods(your
function) within VBA

so a VB DLL called MyactiveX needs to contain at least one object ie.
Myobject, that is creatable

Then set a reference and use the following code:

DIm newobj as new MyactiveX.Myobject

newobj.AddInMsg

There are a lot of docs on creating standard VB ActiveX components, and
that is all you need.

DM Unseen

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default DLL Entry Points

Hi DM Unseen

I dont fully understand what you mean by having a creatable object in my
DLL. I have search on this and found a lot of information that supports what
you have said, but nothing that I understand enough to implement. Could you
possibly post a simple example? It would really help me out.

Many thanks


"DM Unseen" wrote:

A VB COM/ActiveX component is the best option.

My guess is that you are not just creating any COM/ActiveX component,
but actually an Office COM Addin. For a COM addin you can access it
thru

Applications.Commandins("Myaddin").Object.AddInMsg


Note the declare is not required. Also realise that if you do not need
the COM callback functionality (i.e. you just want a VB library
accessible from VBA) a normal ActiveX will do.

ActveX componenets are objects within VBA just like e.g. the Office
Object library, they are Com libraries that contain objects that need
to be instantiated. After that you can access their methods(your
function) within VBA

so a VB DLL called MyactiveX needs to contain at least one object ie.
Myobject, that is creatable

Then set a reference and use the following code:

DIm newobj as new MyactiveX.Myobject

newobj.AddInMsg

There are a lot of docs on creating standard VB ActiveX components, and
that is all you need.

DM Unseen


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default DLL Entry Points

What DM Unseen means is that it appears that you created an Add-In. The
giveaway is the AddinInstance_OnConnection(). This sub is created for
add-in's.

What you want to do is start a new project as an ActiveX DLL. If you're
unfamiliar with how to do this, no offense, but you really should buy a
decent VB6 book. It's pretty easy but there's still too much to go into
on a forum. The upside is that you can often find good used VB6 books
for cheap these days.

Quickly, though, when you wrote
Private Declare Sub AddInMsg Lib "MySubAddIn.dll" ()


This is the wrong way to set a reference to a VB DLL. This syntax is
for Win32 API DLL's (simply put, DLL's that come with Windows). For
DLL's that you create, you will want to set a reference to them in your
VBA editor by using Tools References then browse for your DLL name.

----
Nick Hebb
BreezeTree Software
http://www.breezetree.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Format numbers from percentage points to basis points Robaroo Excel Discussion (Misc queries) 2 April 3rd 23 06:58 PM
Calculate points for and points against Frank@D&D Office Plus Excel Worksheet Functions 1 October 21st 08 09:30 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM
How do I find points on a curve between known points? Cybertori Excel Worksheet Functions 1 August 30th 06 07:57 PM


All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"