• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

Export Report to Excel

So I have a report that I want to export to Excel using the Wizard Access 2010 provides.  But the font style and size are not being sent into the Excel file.

In other words, the font for a text box on the report is Ariel, but when the resulting Excel file is created the font is Verdana.
  • 2
1 Solution
The export wizard is very rudimentary... you have no control over the format of the excel file.

Your alternative is excel automation.  See this example:

Automation basically opens Excel and gives you the same full control over the spreadsheet through VBA code that you would get working directly through Excel's user interface.  The trade-off of course is that it can get very code intensive.

For something as minor as the font... I personally would live with the default font in the wizards export.
Are you looking to actually manipulate the exported data using Excel, or simply export it in a non-Access format?

If the latter, try exporting to PDF instead of Excel, which will keep the same layout.
Jeffrey CoachmanMIS LiasonCommented:
Also,...if your only issue here is the font, then in Excel you can run code like this to change all the cells to Arial

Sub AllArial()
    Selection.Font.Name = "Arial"
End Sub

You can set also set this to run from Access after the import, but that would get a little more complicated, ...but it is do-able...

Rey Obrero (Capricorn1)Commented:
here is how to change the Excel font using Access code

sub changeXLFont()
dim xlObj
set xlObj = createObject("excel.application")
    xlObj.workbooks.open <path to excel file>
    with xlObj
        .selection.font.Name = "Arial"
        .selection.font.Size = 12
    end with
end sub

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now