PDA

View Full Version : VBA to exe



robert32
03-21-2012, 09:41 AM
Hi all,

Please can anyone advise how to convert VBA code to an .exe?


Thanks,

Rob.

fumei
03-21-2012, 10:08 AM
You can not do it. You have to write the code in VB. They are very similar, but not exactly. Still, you need something (if not VB) that will produce EXE. VBA does not.

Frosty
03-21-2012, 10:08 AM
I believe the short answer is: you can't.

VBA is, by definition, Visual Basic For Applications-- that means it runs via another application (Word, Excel, Powerpoint and Access).

However, you can (if you have something like Visual Basic or Visual Studio) take existing VBA and put it into a VB or VS project and compile into an executable.

I believe there is a free or cheap version of Visual Studio available from Microsoft.

Can you give any more info on what you want to do?

fumei
03-21-2012, 10:17 AM
Like I stated, most (say 90%) of VBA code can be put into VB and it will compile...but not everything. You have to carefully test. There are differences in syntax, and differences in objects and methods as well.

Also remember that VB can compile DLL as well as EXE. If you do not actually need an EXE you may want to consider making a DLL instead.

fredlo2010
04-24-2012, 11:53 AM
I wish there was a way to do this. :(

fumei
04-24-2012, 09:01 PM
Too bad. There is not. VBA means Visual basic for Applications. You need to use it inside a compliant application.

"I wish there was a way to do this."

I think what you mean is an easy way to do this. It can be done. Well not exactly. You can not convert VBA code to a stand-alone executable. But for sure you can make your VBA code into stand-alone executable VB.