Adding a Title Row to Queries Exported in .xls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Pardon me if this is a basic question. I have a query that gets exported to
Excel and am wondering if and how to add a title to the top row of the
exported query. Any thoughts or suggestions?

Thank you in advance.
 
If: avoid doing so if you can.

How: open the worksheet, insert a row at the top, and enter the title. (This
can be done either manually or by writing Access VBA code to automate
Excel).
 
Any ideas on where I could find the code?

John Nurick said:
If: avoid doing so if you can.

How: open the worksheet, insert a row at the top, and enter the title. (This
can be done either manually or by writing Access VBA code to automate
Excel).
 
There's a brief sample of Excel automation at
http://www.mvps.org/access/modules/mdl0006.htm
which should get you started.

Basically it's just a matter of working out the Excel code to do what
you want. It might be something like this:

With objActiveWkb.Sheets("Sheet1")
.Rows(1).Insert 'insert a row at the top
.Cells(1,1).Formula = "This is the title"
.Cells(1,1).Font.Bold = True
End With
 
Back
Top