Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Trouble call VB ActiveX dll from Excel

I'm having trouble calling my activex dll function from Excel.

If I use
Public Function funcR2L(strDonorSetIn As String, strRecipeIn As String) As
Variant
Dim varReturnedAns(4) As Variant
Dim intI As Integer
Dim varAns() As Variant
Dim L2R As Object

Set L2R = New lab2Recipe.VBLab2Click
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)

I get the error message Run-time error '5' Invalid procedure or argument.

I get the same error with
Dim L2R as lab2Recipe.VBLab2Click
Set L2R = New lab2Recipe.VBLab2Click
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)

I've tried using the declare statement instead, but then I get an error
stating that the entry point for the function is not found. I saw references
stating that this type of dll must be generated in 'C' but I'm not sure.

I've also tried to create an Object using:
Dim L2R As Object
L2R = CreateObject("lab2Recipe.VBLab2Click")
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)
Again I get the same error message.

I have set the references to my dll. I have registered my dll. My function
is in a class module called VBLab2Clik in a dll called lab2Recipe.dll defined
as:

Public Function funcRecipe2Lab(strFolderName As String, _
strClickRequest As String) As Variant()
Dim varAns(4) As Variant
Dim intI As Integer
Dim varLabEst As Variant

varLabEst = funcStrClick2Lab(strFolderName, strClickRequest)
For intI = 1 To 4
varAns(intI) = varLabEst(intI)
Next intI
funcRecipe2Lab = varAns
End Function

I used a group with additional forms to call this same function from a VB
program with no problems.

Can anyone tell me what else I need to do? Thanks.
PS, I have a subroutine defined in the class module that works from Excel
using:

Public Sub subClick2ClickList(strRecipeListIn As String, _
strDonorSetIn As String, _
strRecipeListOut As String, _
strDonorSetOut As String, _
strSpecialSetting As String)

Dim L2R As VBLab2Click
Set L2R = New VBLab2Click
L2R.subRList2RList strRecipeListIn, strDonorSetIn, _
strRecipeListOut, strDonorSetOut, strSpecialSetting
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Trouble call VB ActiveX dll from Excel

To Whomever reads the above:

I found it! I was able to track down that input I was passing to
L2R.funcRecipe2Lab was incorrect causing it to error. It took a while. The
DLL calls were correct. To debug this, first I created simple DLL Class
Functions, called them, and returned answers to Excel. Then I modified them
to call the same internal function as the one that was failing and obtained
the error message. So I figured that the error message was from within the
function call and not the call itself. Next I stepped through the code in a
VB Group which contained the DLL and a form that let me call it. I noticed
that my input string was different, modified the input string used in Excel,
and it magically started working! I'm on my way to calling the same DLL code
from VB, Excel, and lastly an ASP.

"Kurt M. Sanger" wrote:

I'm having trouble calling my activex dll function from Excel.

If I use
Public Function funcR2L(strDonorSetIn As String, strRecipeIn As String) As
Variant
Dim varReturnedAns(4) As Variant
Dim intI As Integer
Dim varAns() As Variant
Dim L2R As Object

Set L2R = New lab2Recipe.VBLab2Click
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)

I get the error message Run-time error '5' Invalid procedure or argument.

I get the same error with
Dim L2R as lab2Recipe.VBLab2Click
Set L2R = New lab2Recipe.VBLab2Click
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)

I've tried using the declare statement instead, but then I get an error
stating that the entry point for the function is not found. I saw references
stating that this type of dll must be generated in 'C' but I'm not sure.

I've also tried to create an Object using:
Dim L2R As Object
L2R = CreateObject("lab2Recipe.VBLab2Click")
varAns = L2R.funcRecipe2Lab(strDonorSetIn, strRecipeIn)
Again I get the same error message.

I have set the references to my dll. I have registered my dll. My function
is in a class module called VBLab2Clik in a dll called lab2Recipe.dll defined
as:

Public Function funcRecipe2Lab(strFolderName As String, _
strClickRequest As String) As Variant()
Dim varAns(4) As Variant
Dim intI As Integer
Dim varLabEst As Variant

varLabEst = funcStrClick2Lab(strFolderName, strClickRequest)
For intI = 1 To 4
varAns(intI) = varLabEst(intI)
Next intI
funcRecipe2Lab = varAns
End Function

I used a group with additional forms to call this same function from a VB
program with no problems.

Can anyone tell me what else I need to do? Thanks.
PS, I have a subroutine defined in the class module that works from Excel
using:

Public Sub subClick2ClickList(strRecipeListIn As String, _
strDonorSetIn As String, _
strRecipeListOut As String, _
strDonorSetOut As String, _
strSpecialSetting As String)

Dim L2R As VBLab2Click
Set L2R = New VBLab2Click
L2R.subRList2RList strRecipeListIn, strDonorSetIn, _
strRecipeListOut, strDonorSetOut, strSpecialSetting
End Sub


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 do I use ActiveX calendar in an excel? Ron de Bruin Excel Programming 1 October 12th 06 01:43 PM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
How do I use ActiveX calendar in an excel? Pasting column width and row heights Excel Programming 0 September 16th 04 04:25 PM
Trouble w/ ActiveX Controls (no userform) Excel 2002. Chris Excel Programming 2 November 14th 03 06:36 PM
USING ACTIVEX EXCEL.APPLICATION Achint Srivastava [MS] Excel Programming 0 August 5th 03 02:23 PM


All times are GMT +1. The time now is 07:37 PM.

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"