View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Excel VBA to VB6 Conversion

There may well be problems in a stand alone Exe, I've never tried. At the
very least would require Office is installed on user's system.


In 90% of the cases in which I've used VB6, it was because the end user
might not have Office installed. So my very brief excitement about using VBA
forms in a quick and dirty VB6 app was quickly squelched. Thanks for
nothin'!

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Peter T" <peter_t@discussions wrote in message
...
Hi Nick,

I use Userforms (Forms2) without any problem at all in VB6, at least none
I've ever been aware of. Even a complex form with many controls and a lot
of
code.

Whilst there is vastly more scope with the VB form (and learning curve)
there are just a few things a userform does better. Having said that only
I've only used in a dll to be called from Excel, either as a Com-addin or
plain dll.

With the 'userform' in the designer can edit normally, add controls from
the
toolbox, etc. The only difference is the form's external size & position
units are in VB 'style'.

There may well be problems in a stand alone Exe, I've never tried. At the
very least would require Office is installed on user's system. Without
Office it would mean distributing the Forms2.dll which, if that's
possible,
I assume (?) would contravene license.

Regards,
Peter T


"NickHK" wrote in message
...
Bob,
Actually VBA forms can be imported in a VB5/6 project, but loose the form
aspect and become designers.
However, controls from the Forms2.dll are not supprted in VB5/6 and will
(probably) lead to erratic behaiour and various "Out of Memory" errors.

So your comment "userforms will need to be recut" is advisable due to the
above limitations.

NickHK

"Bob Phillips" wrote in message
...
In many ways there is little conversion that needs to be done, but
there

are
three important areas that you have to address

workbook and worksheet event code don't work in VB (although they will

still
work if embedded in an Excel workbook that you open)

userforms will need to be recut, they VBA can't be imported into VB

most importantly, you need to create an instance of Excel, or point to

an
existing instance, and qualify all books, sheets with the parent

objects,
like this

Dim oApp As Object
Dim oWB As Object
Dim oWS As Object

On Error Resume Next
Set oApp = GetObject(, "Excel.Applicatioin")
On Error GoTo 0

If oApp Is Nothing Then
Set oApp = CreateObject("Excel.Application")
End If

Set oWB = oApp.Workbooks.Open("C:\myfile.xls")

Set oWS = oWB.Worksheet("Summary")


--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my

addy)

"MB" wrote in message
...
Hi,

I have an Excel Add-in .xla file that is working fine. Would like to
convert
it to VB6 code to create a stand alone application. Is it possible to

do?
Any
help on how to start would be appreciated.

Thanks,
MB