How to create Excel workbook from VB6?
"Bob Phillips" wrote in message
...
"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)
While that's possible (Micro$oft can break anything), I've never experienced
it. I've written over 100,000 lines of VBA specifically for Excel for 7
clients dating back to 1994. Not one line has broken because a method or
property has disappeared.
MS Outlook, on the other hand... =8-((
Austin
|