How to convert VBA code into EXE file which can be executed by Excel workbook?

M

meiwr

Dear Excel Experts:

I wrote lots of VBA codes to conduct some special tasks, and I don't
want the end users to view the code. I know that the VBA code can be
converted into a DLL file which can be loaded when needed. But this way
wouldn't have some disadvantages. A major disadvantage is that the end
user has to code it for calling any specific functions or subs defined
in the DLL file. Another is there is no way to set up menu items or
command bars.

I'd like the VBA codes to be compiled/saved in an EXE file like in an
Excel Add-in file, which can be loaded up by Excel workbook when opened
like the following:

Sub Auto_Open
Workbooks.Open Filename:="c:\xxx\'MyExeFileName'.exe"
Application.Run Macro:="Task1"
End Sub 'Auto_Open

In the above scenario, task1 is the entry point to set up environment
parameters for my specific tasks, such as setting up menu items,
command bars which link to the procedures defined in the EXE file. The
"MyExcelFileName.exe" will be shown in the VBA project window of Excel
VBE. But when you double-click on it, you got an error message "Project
is unviewable" .

In this way, the end user performs a certain task like running a
standalone EXE application except under Excel application.

My question is

A. How to convert the VBA code contained in an Excel workbook into an
EXE file and to make it work in the way described above?

I do know it works in that way as I downloaded one example of that from
Internet.

Any detailed suggestion/thoughts will be greatly appreciated.

Kind regards,

Ken
 
J

Jim Thomlinson

What you are describing is Automation or COM addins. If you are intending to
do this then you really need to be developing in VB6 (or possibly C/C++).
While you can use Office Developer edition you can not set classes as Public
Creatable (necessary for Automation). If you intend to get into this I would
recommend getting a good book on the subject. I would recommend...

http://www.oaltd.co.uk/ExcelProgRef/Default.htm

This is an excellent reference book...
 
K

Ken

Thanks for your information, Jim. but I couldn't open the link to read
more information you would suggest. Could you please check that again
or describe a little bit more? I'm familiar with VB6, not with C/C++.

Thanks,

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top