Convert VBA to VB?

B

BradC

Can I convert a VBA application to VB6.0. Are most
things similar or would the application have to be
completely rewritten?
..
 
D

Dave

'it depends'. vba is meant to run in the framework provided by another
application. so when it runs under excel it has automatic access to
workbooks and sheets and cells and all the related excel objects, when it
runs under access it has tables and forms and reports and all the stuff that
access provides, etc.... vb6 just has itself, you can create objects out of
office ole interfaces, but you don't have them automatically. besides the
references to built in office objects in the apps it should be mostly
compatible.
 
N

Norman Yuan

It depends on how much the VBA code involves the host application's objects
and/or other objects from other library(mostly, COM DLLs).

If the code mainly deals with host app objects very little, such as addition
of A and B, then it will will be much the same in VB. However, most VBA code
deals a lot with the objects in the host app and VBA environment provides a
direct access to these objects. If you want to do the same thing in
stand-alone VB program, you must create those objects by yourself.

Also, the visual part of VBA, i.e. controls like text box, forms... are
different from those used in VB. Thus, the VBA code dealing with the visual
components will not work in VB, you need to re-write it.

Since your question is in Access group, you need to realize that Access's
VBA code is a lot different from VB. There are some programs claiming being
able the transfer VBA to VB, but I do not believe such transfer can do a
good enough job. Only your brain and you hand can do a reasonably acceptable
converting, I mean, re-writing.
 
Top