From: David Youngblood on
> "johnstubbe" <johnstubbe(a)frontiernet.net> wrote...
> On Mar 15, 10:48 am, "Bob Butler" <no...(a)nospam.ever> wrote:
>> "johnstubbe" <johnstu...(a)frontiernet.net> wrote in message
>>
>> > Hi,
>>
>> > This is my first attempt at using VB6 to export an excel file.
>> > The Microsoft Excel Object Library that I apparently need is
>> > missing from my Available References in the IDE.
>>
>> > I thought that I might need to have Excel installed on my computer. I
>> > Googled for Excel. The best I was able to find was MS Office Excel
>> > Viewer 2003, which I installed and am able to view Excel files. Still
>> > no IDE reference to Excel.
>>
>> > I hope it's not necessary to buy Excel since I don't use Excel.
>>
>> yes, if you want to reference Excel from VB then you are using Excel and
>> you
>> need to buy and install it. You could create a CSV file, or some other
>> format that Excel recognizes, from VB with straight file I/O but in order
>> to
>> reference and automate Excel you need to have Excel.

> Thanks,
> Not what I wanted to here. I have no use for Excel. A
> customer requested, as a favor, an excel file in place of
> the standard CSV file. He is not willing to buy me a
> copy of Excel and I won't. A trial version isn't
> acceptable due to on going updates to his program. I
> don't want to use Excel, I just want to export an excel
> file using VB6, that can be imported into the customers
> Excel program. I can't afford to spend much time or
> money on this project.

You do not need Excel to automate Excel on your customer's machine. You can
use late binding to create an Excel object only if it's available. Having
access to a copy, even a trial version, would help in testing.

On Error Resume Next

Dim oXL As Object
Set oXL = CreateObject("Excel.Application")
If Not oXL Is Nothing Then
Debug.Print "Export to Excel"
Else
Debug.Print "Export to CSV"
End If

David


From: Paul Clement on
On Mon, 15 Mar 2010 06:53:34 -0700 (PDT), johnstubbe <johnstubbe(a)frontiernet.net> wrote:

� Hi,

� This is my first attempt at using VB6 to export an excel file.
� The Microsoft Excel Object Library that I apparently need is
� missing from my Available References in the IDE.

� I thought that I might need to have Excel installed on my computer. I
� Googled for Excel. The best I was able to find was MS Office Excel
� Viewer 2003, which I installed and am able to view Excel files. Still
� no IDE reference to Excel.

� I hope it's not necessary to buy Excel since I don't use Excel.

� Thanks,
� John

You can also use data access (Excel not required) to export data to an Excel Workbook:

How To Transfer Data from ADO Data Source to Excel with ADO
http://support.microsoft.com/kb/295646/EN-US/


Paul
~~~~
Microsoft MVP (Visual Basic)