XLL file and VB6 Applications
I have an .XLL file from Excel that contains a function that I would like to use in a VB6 program.
While I do not know what the function does from within (blackbox) and do not really care, I do know the parameters it takes and what type it returns.
So the only thing I need is to know if I can use an XLL function from within VB6, and if so, how?
Thank you.
Re: XLL file and VB6 Applications
Use VBA, but users MUST have Office installed, otherwise, it will fail. You are not allowed to distribute any OFFICE files.
Re: XLL file and VB6 Applications
So does that mean that you cannot call a XLL function from within VB6?
I have no desire to distribute office files. This is for my own personal use.
But I would like to use the function within VB6 app, not a VBA program.
And yes, I have office installed.
Re: XLL file and VB6 Applications
Then, the easiest way is to write a MACRO (or just RECORD it). That will give you the VBA source code, which can usually be adapted to VB6 pretty easily.
Re: XLL file and VB6 Applications
Thanks for your reply.
Unfortunately, recording a Macro is not going to show how to call a function from within a XLL file inside VB6 code.
1 Attachment(s)
Re: XLL file and VB6 Applications
Take a look at this. Also, there's an AUTOSTART macro that will run a macro automatically
Re: XLL file and VB6 Applications
First, I would like to say thank you for taking time on this. Very generous of you. :-)
Unfortunately, we have not been addressing the problem I am asking about.
In the example code you provided, there are NO REFERENCES to any functions within a .XLL file.
Please understand, I am NOT trying to control Excel from VB6. I do not want to write or read anything from an Excel Worksheet.
What I want to do is to use a .XLL file that contains FUNCTIONS normally used within Excel. I want to use them in VB6, just like if it were a .DLL file.
Stand-alone VB6 app using a function compiled in a XLL file.
I need to know if this is possible, and if so, how?
Again, your code only manipulates Excel worksheets to do this or that, but does NOT use any functions from a XLL file.
Thanks again.
:)
Re: XLL file and VB6 Applications
Well, if a MACRO were to READ YOUR PARAMETERS, and EXECUTE whenever it was opened, your program would WRITE THE PARAMETERS, and start Excel with the worksheet set to open and execute AUTOSTART
Re: XLL file and VB6 Applications
Yes, but I do not want to open Excel, or a spreadsheet.
I do not wish to use Excel at all.
I can use the functions within xlMath.xll in my Excel programs by declaring xlMath.xll within a VBA program.
I only want to use a .XLL function in VB6 to create a Stand-alone VB app.
Public Declare Function XLLFunc Lib "xlMath.xll" (ByVal emb As Integer, ByVal Data As Single, ByVal iFirst As Integer, ByVal iLast As Integer, Optional flgdt As Boolean, Optional flgstd As Boolean)
If it were a DLL, it would be something like the above.
I'm only trying to find out if I can do the same with a XLL, and if so, how.
No Excel. No Worksheets.
Thanks.
Re: XLL file and VB6 Applications
What kind of functions are we talking about? I assume they are generic with no excel requirement.
I suppose you do not have the code for this xll file right?
Re: XLL file and VB6 Applications
Something I found on the net, may help?
Quote:
An xll is just a dll. If you know the signature of the function you want to call, you can call it just like any other function. If you don't know the signature but can load the add-in in Excel, there is a way to get Excel to tell you the signature.
Automation only works if you are running Excel. There is no need for that once you know the signature.
More info that may be of some help.
http://www.cpearson.com/excel/AutomationAddIns.aspx
Re: XLL file and VB6 Applications
Thanks.
I will check that out.
But yes, I know the signature. I guess that means if I know what parameters it takes and what it returns. This I know.
I don't know if they have Excel requirements. I'm hoping they do not. As you just found, they should be just like DLL's. But I cannot seem to get the DECLARE to work with it like a DLL. So I'm thinking there must be something else to it.
:)
Re: XLL file and VB6 Applications
Except that they might be compiled in C++ using POINTERS, which VB6 does not have the ability to utilize...
Re: XLL file and VB6 Applications
Yep. Kinda hitting a brick wall on this.
Thanks. :)