Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
LLT LLT is offline
external usenet poster
 
Posts: 5
Default XLL Functions from Excel VBA

Hi,

I am trying to call a function in an installed XLL addin in excel. Unless I
declare the function, I cannot use it.

If I use this declaration:
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As
Variant) As Long
and call:
EssVDisconnect "SheetName"
it works.

But if I try to use it this way (without a declaration), it doesn't work:
Application.Run "ESSEXCLN.XLL!EssVDisconnect", "SheetName"

Can someone explain if it is required for calling XLL functions from VBA to
always Declare their functions?

Thanks,

Leo


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default XLL Functions from Excel VBA

I don't see how either of your examples would work as posted. The argument
SheetName is received ByVal so even if changed in the function it would
return as originally passed. The function returns a Long but in neither
example have you assigned its result. Or does the function do something to
the sheet object.

Even if the purpose was to process SheetName and return it modified, the
app.run method would not work as variables passed as arguments are converted
to values before passing, iow they will not return modified.

Apart from the above, if anything I would have thought the application.run
method would be more likely to work than the API like Declare method. For
the Declare method to work I think, though not sure, it means the author has
included additional methods to enable the function to be called directly in
VBA. If Declare does work use it that way in preference to app.run as it
would be very significantly faster than app.run.

Regards,
Peter T

"LLT" wrote in message
...
Hi,

I am trying to call a function in an installed XLL addin in excel. Unless
I declare the function, I cannot use it.

If I use this declaration:
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As
Variant) As Long
and call:
EssVDisconnect "SheetName"
it works.

But if I try to use it this way (without a declaration), it doesn't work:
Application.Run "ESSEXCLN.XLL!EssVDisconnect", "SheetName"

Can someone explain if it is required for calling XLL functions from VBA
to always Declare their functions?

Thanks,

Leo



  #3   Report Post  
Posted to microsoft.public.excel.programming
LLT LLT is offline
external usenet poster
 
Posts: 5
Default XLL Functions from Excel VBA

Hi Peter

The reason why I haven't assigned the result of the function to a variable
or what the function actually does to the objects passesd to it is
irrelevant to my question. The example using declarations works without
errors and as expected. The example using the Run method does not work. I
was trying to assess why in need to declare the functions in advance for
this particular XLL add-in, when for calling other functions I can use the
Run method directly....thanks for your input anyway.

Leo

"Peter T" <peter_t@discussions wrote in message
...
I don't see how either of your examples would work as posted. The argument
SheetName is received ByVal so even if changed in the function it would
return as originally passed. The function returns a Long but in neither
example have you assigned its result. Or does the function do something to
the sheet object.

Even if the purpose was to process SheetName and return it modified, the
app.run method would not work as variables passed as arguments are
converted to values before passing, iow they will not return modified.

Apart from the above, if anything I would have thought the application.run
method would be more likely to work than the API like Declare method. For
the Declare method to work I think, though not sure, it means the author
has included additional methods to enable the function to be called
directly in VBA. If Declare does work use it that way in preference to
app.run as it would be very significantly faster than app.run.

Regards,
Peter T

"LLT" wrote in message
...
Hi,

I am trying to call a function in an installed XLL addin in excel. Unless
I declare the function, I cannot use it.

If I use this declaration:
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As
Variant) As Long
and call:
EssVDisconnect "SheetName"
it works.

But if I try to use it this way (without a declaration), it doesn't work:
Application.Run "ESSEXCLN.XLL!EssVDisconnect", "SheetName"

Can someone explain if it is required for calling XLL functions from VBA
to always Declare their functions?

Thanks,

Leo





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default XLL Functions from Excel VBA

What do you mean by "The example using the Run method does not work", eg it
errors, it does not do anything, it does something incorrectly, etc

I don't understand the sentence beginning "I was trying to assess..."

However if you can use the Declare approach why not stick with that as it
will work very considerably faster than app.run.

Regards,
Peter T



"LLT" wrote in message
...
Hi Peter

The reason why I haven't assigned the result of the function to a variable
or what the function actually does to the objects passesd to it is
irrelevant to my question. The example using declarations works without
errors and as expected. The example using the Run method does not work. I
was trying to assess why in need to declare the functions in advance for
this particular XLL add-in, when for calling other functions I can use the
Run method directly....thanks for your input anyway.

Leo

"Peter T" <peter_t@discussions wrote in message
...
I don't see how either of your examples would work as posted. The argument
SheetName is received ByVal so even if changed in the function it would
return as originally passed. The function returns a Long but in neither
example have you assigned its result. Or does the function do something to
the sheet object.

Even if the purpose was to process SheetName and return it modified, the
app.run method would not work as variables passed as arguments are
converted to values before passing, iow they will not return modified.

Apart from the above, if anything I would have thought the
application.run method would be more likely to work than the API like
Declare method. For the Declare method to work I think, though not sure,
it means the author has included additional methods to enable the
function to be called directly in VBA. If Declare does work use it that
way in preference to app.run as it would be very significantly faster
than app.run.

Regards,
Peter T

"LLT" wrote in message
...
Hi,

I am trying to call a function in an installed XLL addin in excel.
Unless I declare the function, I cannot use it.

If I use this declaration:
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As
Variant) As Long
and call:
EssVDisconnect "SheetName"
it works.

But if I try to use it this way (without a declaration), it doesn't
work:
Application.Run "ESSEXCLN.XLL!EssVDisconnect", "SheetName"

Can someone explain if it is required for calling XLL functions from VBA
to always Declare their functions?

Thanks,

Leo







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default XLL Functions from Excel VBA

Leo

Non of the V functions are registered with Excel because they are not
for use from a worksheet cell, they are the VBA versions that you call
via the declares.

Why dont you just import the EssVBA.txt module with all the declares in?

You could try the calling the XLM version from the spreadsheet toolkit
if you are determined to use app.run.

Cheers
Simon
Blog: www.smurfonspreadsheets.net
Website: www.codematic.net Excel development, support and training



LLT wrote:
Hi Peter

The reason why I haven't assigned the result of the function to a variable
or what the function actually does to the objects passesd to it is
irrelevant to my question. The example using declarations works without
errors and as expected. The example using the Run method does not work. I
was trying to assess why in need to declare the functions in advance for
this particular XLL add-in, when for calling other functions I can use the
Run method directly....thanks for your input anyway.

Leo

"Peter T" <peter_t@discussions wrote in message
...
I don't see how either of your examples would work as posted. The argument
SheetName is received ByVal so even if changed in the function it would
return as originally passed. The function returns a Long but in neither
example have you assigned its result. Or does the function do something to
the sheet object.

Even if the purpose was to process SheetName and return it modified, the
app.run method would not work as variables passed as arguments are
converted to values before passing, iow they will not return modified.

Apart from the above, if anything I would have thought the application.run
method would be more likely to work than the API like Declare method. For
the Declare method to work I think, though not sure, it means the author
has included additional methods to enable the function to be called
directly in VBA. If Declare does work use it that way in preference to
app.run as it would be very significantly faster than app.run.

Regards,
Peter T

"LLT" wrote in message
...
Hi,

I am trying to call a function in an installed XLL addin in excel. Unless
I declare the function, I cannot use it.

If I use this declaration:
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As
Variant) As Long
and call:
EssVDisconnect "SheetName"
it works.

But if I try to use it this way (without a declaration), it doesn't work:
Application.Run "ESSEXCLN.XLL!EssVDisconnect", "SheetName"

Can someone explain if it is required for calling XLL functions from VBA
to always Declare their functions?

Thanks,

Leo






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 convert cell formula functions to code functions Adnan Excel Discussion (Misc queries) 1 October 1st 08 08:30 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Conversion from Spreadsheet Toolkit functions (ESSV....) to EssBase API functions sujay Excel Programming 0 June 5th 06 10:13 AM
User-defined functions created in Excel 2000 fail in Excel 2003 goodguy Excel Discussion (Misc queries) 1 October 3rd 05 07:04 PM
excel functions and User defined functions Kanan Excel Programming 4 May 20th 04 11:21 PM


All times are GMT +1. The time now is 12:04 AM.

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

About Us

"It's about Microsoft Excel"