Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Calling an XLL from VB?

I have an ancient XLL plugin for XL that we use, and since the time we
purchased it we've moved most of our code to VB. I'd like to move this over
as well, but I'm not sure how to do it. Is there some way to load an XLL into
VB? And if so, how do we call it? The XLL is currently called use
"Application.Run", but I'm not entirely sure what this command does.

Maury
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Calling an XLL from VB?

Wish this will help you
http://www.planatechsolutions.com/xlpfaq/Q0032.htm


Maury Markowitz a écrit :

I have an ancient XLL plugin for XL that we use, and since the time we
purchased it we've moved most of our code to VB. I'd like to move this over
as well, but I'm not sure how to do it. Is there some way to load an XLL into
VB? And if so, how do we call it? The XLL is currently called use
"Application.Run", but I'm not entirely sure what this command does.

Maury


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Calling an XLL from VB?

"Franck" wrote:

Wish this will help you
http://www.planatechsolutions.com/xlpfaq/Q0032.htm


Well it's not EXACTLY what I need, but it will likely help me get there.
Thanks!

Maury
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling an XLL from VB?

An XLL is a special form of Dynamic Link Library (DLL). It is compiled from
C or C++ source code probably. So you would not have any way to view the
code in VB.

You would basically have to figure out what the functionality is, develop an
algorithmic approach to achieve that functionality, then program it from
scratch in VB.

Application.Run does just what you say, it causes the xll's code to execute.

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
"Franck" wrote:

Wish this will help you
http://www.planatechsolutions.com/xlpfaq/Q0032.htm


Well it's not EXACTLY what I need, but it will likely help me get there.
Thanks!

Maury



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Calling an XLL from VB?

Maury,
As Tom says, an XLL is compiled, so forget about seeing the code.
I'm not sure how different an XLL is from a standard DLL, but with the only
XLL that I have on my system (ANALYS32.xll), calls to it seem routed through
XLCALL32.DLL's "Excel4V" function. So, assuming the actual call, arguments
and return type etc are correct (which I am not), this will not work:
Private Declare Function XLLFunc1 Lib "C:\ANALYS32.XLL" Alias "bin2dec"
(BinStr As String) As Long

There probably are ways of using the XLL directly, but not sure how straight
forward in VB:
http://www.delphi3000.com/articles/article_4104.asp?SK=

However, it does seem a rewrite would be easier if you understand the
concepts of the functions in the XLL and create an ActiveX DLL that's native
to VB or a standard DLL with some extra work.

NickHK

"Maury Markowitz" wrote in
message ...
"Franck" wrote:

Wish this will help you
http://www.planatechsolutions.com/xlpfaq/Q0032.htm


Well it's not EXACTLY what I need, but it will likely help me get there.
Thanks!

Maury





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Calling an XLL from VB?

"Tom Ogilvy" wrote:

An XLL is a special form of Dynamic Link Library (DLL). It is compiled from
C or C++ source code probably. So you would not have any way to view the
code in VB.


I don't care about seeing the code. The code I'm talking about moving is OUR
code, which was in Excel and is now in Access. The XLL is a black box, and
that's fine.

You would basically have to figure out what the functionality is, develop an
algorithmic approach to achieve that functionality, then program it from
scratch in VB.


DLL's are generally easy to call from VBA, as long as you know the method
sig. I do in this case. I need to know how to do that into an XLL.

Application.Run does just what you say, it causes the xll's code to execute.


But how? Exactly what does "Application.Run" mean? Does it call the DLL
loader? Does it hop into a known starting point? What _exactly_ does it do? I
can call Application.Run on methods in other VBA programs, so it's not simply
trivially simple.

Maury
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling an XLL from VB?

You would call the XLL same as you would a DLL by putting in a declaration.

For application.run to work, I believe you have to use the register function
to register it.


As to run, you look at the vba help on the run command in Excel VBA. Also
several alternative including that are discussed he

http://tinyurl.com/yfyrpr

At Laurent Longre's site
http://xcell05.free.fr/
select the english page and at the bottom are links to information on XLL's

--
Regards,
Tom Ogilvy


"Maury Markowitz" wrote in
message ...
"Tom Ogilvy" wrote:

An XLL is a special form of Dynamic Link Library (DLL). It is compiled
from
C or C++ source code probably. So you would not have any way to view the
code in VB.


I don't care about seeing the code. The code I'm talking about moving is
OUR
code, which was in Excel and is now in Access. The XLL is a black box, and
that's fine.

You would basically have to figure out what the functionality is, develop
an
algorithmic approach to achieve that functionality, then program it from
scratch in VB.


DLL's are generally easy to call from VBA, as long as you know the method
sig. I do in this case. I need to know how to do that into an XLL.

Application.Run does just what you say, it causes the xll's code to
execute.


But how? Exactly what does "Application.Run" mean? Does it call the DLL
loader? Does it hop into a known starting point? What _exactly_ does it
do? I
can call Application.Run on methods in other VBA programs, so it's not
simply
trivially simple.

Maury



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Calling an XLL from VB?

"Tom Ogilvy" wrote:

You would call the XLL same as you would a DLL by putting in a declaration.


I think this is the key. Using the Lib declare seems to work, as if the XLL
is nothing more than a DLL -- which I think is exactly the case, a DLL with
some "known extras" inside that Excel looks for. VB appears to be able to use
it without caring about these extras.

Ok, seeing as this is my first attempt at writing a wrapper from scratch,
would you mind a bit of help mapping the data types in the method sig? This
is the entry in the .h, names have been changed to protect the innocent. As
you can see, the API is basically a bunch of "FPSAFEARRAY", which I assume
stands for "floating point safe array".

__declspec(dllimport) double THING(
FPSAFEARRAY FAR* returnedStuff,
FPSAFEARRAY FAR* oneInput, FPSAFEARRAY FAR* anotherInput...,
LPSTR commands,
LPSTR errors);

My questions are fairly basic... most of the inputs are these arrays marked
"FAR*". Do I wrap these as ByRef? And is the array itself mapped onto a
Variant, or is there something more specific I should use? The LPSTR map onto
ByVal String? Errors is an output, so I think I'm actually wrong on that.

Maury

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
Calling a Sub from another shashi1515[_4_] Excel Programming 5 February 4th 06 03:57 AM
Need Help using/calling a DLL Trip[_3_] Excel Programming 1 January 9th 06 01:36 PM
Need Help Using/Calling DLL Please Trip[_3_] Excel Programming 0 January 8th 06 09:57 AM
Calling an Add-In BillCPA Excel Discussion (Misc queries) 2 August 11th 05 09:32 PM
Calling SUB Peter Longstaff Excel Programming 2 February 23rd 04 08:04 PM


All times are GMT +1. The time now is 04:10 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"