Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    16

    Exporting a query to a specific Excel format

    This question may be obvious to most of you, but I'm still learning the basics of Access. I imported data from an Excel file into Access the other day and ran some queries. Now I want to be able to put this data back into Excel but with some particular formatting issues on cells:

    1. Bold headers
    2. Thin Borders on every cell that has data
    3. Wrapped Text in cells
    4. "best fit" column widths and row heights.
    5. Grey filling on the headers in the excel file.



    Is any of this possible when you export data from Access into Excel? If so, is it more trouble than it's worth?

    Basically my goal is to be able to update this file in Excel, be able to make edits and new entries while in Access, and put it all back in Excel, similar format to how I imported it with also the new entries I would've made in Access.

    Thanks for any responses...

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    That can be done and yes it is a lot of trouble, especially if running the code from Access instead of behind Excel.

    One example of formatting I do in VBA behind Excel:
    'Adjust row height of GEOReport to original setting
    Worksheets("GEOReport").Rows("2:6683").AutoFit
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Apr 2012
    Posts
    16
    Just how complicated would the code be? Tried googling for stuff like this but had no results. I'm not skilled enough with VBA to have the intuitions yet to figure out these sort of things. Worse comes to worse, I would have to manually do these format changes when exporting back to Excel, but it would be amazing if there was a way to have Access do that instead.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Two approaches:

    1. Use the same workbook with formats all set instead of continually creating a new one. VBA code would clear the data from cells and then replace with the new.

    2. Continually create new workbook then use VBA code in Access to set formats.

    Either approach has its own complications but both require handling the Excel file as an Access object. Review http://www.mrexcel.com/forum/showthread.php?t=371835
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. exporting access report to specific excel cells
    By grgold14 in forum Import/Export Data
    Replies: 1
    Last Post: 02-07-2012, 04:38 PM
  2. Exporting to Specific Excel Sheet
    By unrealtb in forum Access
    Replies: 2
    Last Post: 01-24-2012, 10:32 PM
  3. Exporting to .txt with Specific Format
    By KrenzyRyan in forum Import/Export Data
    Replies: 12
    Last Post: 11-18-2011, 04:57 AM
  4. Exporting a Query to Excel
    By tcheck in forum Access
    Replies: 3
    Last Post: 07-22-2011, 05:00 PM
  5. Query Exporting to Excel
    By Coffee in forum Queries
    Replies: 2
    Last Post: 07-18-2011, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums