Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Nov 2005
    Location
    Bismarck, North Dakota, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exporting Report as Excel Spreadsheet (2003)

    I have an Access 2003 report that is exported as an Excel spreadsheet and is then E-mailed to a number of people. This is done using some code behind a command button and was easy enough to do. The issue now is that I need to add text to cells a12-c14. This text will always be the same except for the date, which will be in cell B12. All of this needs to run on the click of the run button.

    The query that returns the results is named 5900mtdc and the report is named CO2. Exporting as a snapshot is not an option. Any/all help is very appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Exporting Report as Excel Spreadsheet (2003)

    Welcome to Woody's Lounge!

    You can use Automation for this, i.e. open an invisible instance of Excel from Access using VBA, and then execute Excel VBA code. You'd have to
    - Start Excel.
    - Open the exported workbook.
    - Fill cells A12:C14.
    - Close and save the workbook.
    - Quit Excel.

    My fellow moderator <!profile=WendellB>WendellB<!/profile> has a nice tutorial on Automation on his website, with useful links: Automation 101.
    If you search this forum for excel.application, you'll find several examples, e.g. <post:=502,023>post 502,023</post:> and <post:=376,265>post 376,265</post:>.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •