View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Excel VBA to VB6 Conversion

workbook and worksheet event code don't work in VB (although they will
still
work if embedded in an Excel workbook that you open)


Just define in a class

Public WithEvents XL As Excel.Application

and you'll get all the events.

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


Actually, they can be, but not as real forms. They're designer objects with
the same limited functionality as VBA UserForms. They don't "upgrade" to VB
Forms.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"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