Link to home
Start Free TrialLog in
Avatar of chestera
chestera

asked on

Spread headings

Hi EE

I generate a spread sheet using the following
FileName = "SmartCashFinancialReport.xls"
Tpath = "C:\SmartCash\AnnualReport\" & FileName
 DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblFinancialReport", Tpath

Is it possibe to add a heading. Any help appreciated

chestera
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

No. For that you will need to use automation - calling Excel to open the worksheet and then manipulate this.

/gustav
SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If by heading you mean column headings, the answer is yes; that is an option in the TransferSpreadsheet method.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chestera
chestera

ASKER

boag2000

Hi Jeff

The spread would look like this
                    Financial Report

Col1             Col2               Col3                 Col4

At the moment I only have the data

Alan
Scott McDaniel

Would that ocmo out like
Heading  Col1 Col2 Col3 etc

Alan
Lets see what Scott posts on his suggestion...

Doing what you are asking above would require vba automation as the first expert suggests.
boag2000

I was just going to test, I have just created a blank spreadsheet with a heading
boag2000

I now generate the spreadsheet then it  opens and the user can enter a header if required

Alan
Scott McDaniel

I tried your suggestion but it's not quite what's need. I get the following
Col1 Col2 Col3,,,,,,, Heading
I need
            Heading
Col1 Col2 Col3 etc

I now generate the spreadsheet then auto opens so the user can enter a heading if required.

The reason for the question I thought there might be some way to incorporate into the DoCmd.Transfer command

Alan
I need
             Heading
Col1 Col2 Col3 etc
That's what I imagined. For this, automation is the only method with the latest and current versions of Microsoft Office.

/gustav
You could union the header with the query you are exporting now and export the union query.  That will get the header on the first line but it will be squished into the first column.  There is no way without automation to center it, etc.

An alternative might be to control the name that appears on the tab.  Excel picks up the name of your query so you could change the query name to be more descriptive.
PartHartman

Thank you Pat. The user can enter a heading of their choice from the generated spreadsheet

Alan
Thank you for your help