----- > write an excel file ... <------ 
Author Message
 ----- > write an excel file ... <------

Hi ppl !

I need to write a Excel file from a datasource ...
I do query from an access database , but i want to store my
results into a excel file...
so if u know the way to do that ...

----------------------------------------
http://www.*-*-*.com/


----------------------------------------

Thanks in advance !   <---



Mon, 19 Feb 2001 03:00:00 GMT  
 ----- > write an excel file ... <------
Hi,

    To export a query result of Access to Excel, the OutputTo command
should do the trick.
    First execute the query and them, type the following on a command
button click event.

    Dim DocName As String
    Dim QryName as String

    FileName = "My Excel Report"
    QryName = "My Excel Query"

    DoCmd.OutputTo acOutputQuery, QryName , acFormatXLS, "TEST.XLS",
True     /*   Access 97 format */

    DoCmd.OutputTo A_REPORT, "My Excel Query", A_FORMATXLS   /* Access
2.0 format */

The other way to do it is to write a macro with the DoCmd and call it
from a button. For more information lookup the help on OutputTo

Hope this helps.

Ricardo H.Marshall

Quote:
> -----Original Message-----

> Posted At: 03 September 1998 10:03
> Posted To: database
> Conversation:      ----- > write an excel file ...  <------
> Subject:   ----- > write an excel file ...  <------

> Hi ppl !

> I need to write a Excel file from a datasource ...
> I do query from an access database , but i want to store my
> results into a excel file...
> so if u know the way to do that ...

> ----------------------------------------
> http://perso.club-internet.fr/kli


> ----------------------------------------

> Thanks in advance !   <---



Mon, 19 Feb 2001 03:00:00 GMT  
 ----- > write an excel file ... <------
Thanks ricky
but my users don't have access installed in their machine ...
so...

I use the dbjet engine
with a datasource control i can add record to an xls file
but i don't know how to create one
and how to add fields
...



Tue, 20 Feb 2001 03:00:00 GMT  
 ----- > write an excel file ... <------
kli,

The following code should do the job.  I pasted most of this code (modified
to protect the innocent) from a recent project.  gdb is the global database
that you are exporting from.  I used the db object to create the new xls
sheet.  Did some checking to make sure I wasn't going to overwrite an
existing file, but cut that portion out.  Let me know if this helps.

Private Sub cmdExport_Click()
    Dim db As Database

    Dim sFN As String
    Dim SQL As String

    sFN="C:\Path\FileName.xls"

    Set db = DBEngine.OpenDatabase(sFN, 0, 0, "Excel 5.0;")

    SQL = "SELECT Field1...FieldX INTO [Excel 5.0;database=" & sFN &
"].TableName FROM TableName"
    gdb.Execute SQL

    Set db = Nothing
End Sub

-Mike

Quote:

>Hi ppl !

>I need to write a Excel file from a datasource ...
>I do query from an access database , but i want to store my
>results into a excel file...
>so if u know the way to do that ...

>----------------------------------------
>http://perso.club-internet.fr/kli


>----------------------------------------

>Thanks in advance !   <---



Sat, 24 Feb 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. <<<<<<<<ComboBox>>>>>>>>>>>>

2. HELP >>>>>>WIN API <<<<<<<<<<

3. <<<Gif Files>>>

4. >>>> WAV file GRAPH <<<<<<<

5. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

6. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

7. <<<<HELP- OLE container Control>>>>>>>>>

8. VB5<->RDO2<->ODBC<->ORACLE Procedure Problem

9. <<<Cneck Box>>>

10. <<<CD ROM>>>

11. <<<Win32Api.TXT>>>

12. <<<NetWork Drv>>>

 

 
Powered by phpBB® Forum Software