Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting to Excel

Status
Not open for further replies.

bradth

IS-IT--Management
Feb 18, 2005
142
CA
I have a form created that allows users to pull data up into a Janus gridex through the use of a query. I also allow the users to export the data from the query to a crystal report. My problem is as follows: there is an extra column that I have added in that appears after the query is run. The users are then able to add data into this column. When they press the save button, the data is saved into an array. What I want to do is include the extra column that is added in, but not included in the query and have it export into excel.

Here is my code for exporting the query to excel (It exports out the crystal report to excel)
Code:
    strExportPath = "C:\" 'where excel will be exported to'
    Set crxExportOptions = crxReport.ExportOptions   

'Exports text boxes on the form to the excel report   
    crxReport.FormulaFields.Item(5).Text = Chr(34) & monumber & Chr(34)
    crxReport.FormulaFields.Item(6).Text = Chr(34) & startdate & Chr(34)
    crxReport.FormulaFields.Item(7).Text = Chr(34) & enddate & Chr(34)
    crxReport.FormulaFields.Item(8).Text = Chr(34) & tosite & Chr(34)
    crxReport.FormulaFields.Item(9).Text = Chr(34) & fromsite & Chr(34)
    
 crxExportOptions.FormatType = crEFTExcel80
    crxExportOptions.DestinationType = crEDTDiskFile
    crxExportOptions.DiskFileName = strExportPath & "Exported.xls"
    'Export the report without prompting the user
    crxReport.Export False

This exports out all of the columns, except for that extra one. Since the data is already included into an array, is it possible to add a couple of lines of code that will include the column and data into the excel export? Any help on this would be much appreciated. Thanks.

Brad [spidey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top