How to create Excel workbook from VB6?
"AustinMN" wrote in message
...
"Bob Phillips" wrote in message
...
Hi Kurt,
If you create an Excel instance, then you have access to all of the
objects.
so as an example
Dim xlApp As Object
Dim xlWB As Object
Dim xlWS As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True ' or not as required
Set xlWB = xlApp.Workbooks.Add
Set xlWS = xlWB.Worksheets.Add
'etc.
A better way (because it's early-bound):
It's horses for courses. Better in some instances, not so in others. It is
not black and white.
The only problem is if the user has an earlier version of Excel and you
use
a method or property that has been introduced since, your app will crash
on
their machine.
And a later version may lose the reference (hence late bound)
|