Solved

Acess Export to excel - font colour

Posted on 2011-03-02
7
313 Views
Last Modified: 2016-05-15
All

A silly question but i need to try and get an answer.

I have a query in Access 2007 that is emailed to recipients in .xls.  However, the exported excel workbook displays light grey font - not black.  

I realise it is easy to change this in the file but ...... recipents want the font to be black.....

any thoughts appreciated
0
Comment
Question by:shaz0503
  • 5
7 Comments
 
LVL 15

Assisted Solution

by:Simon Ball
Simon Ball earned 500 total points
ID: 35025555
Use access object to create some automation

dim xlapp as object
Set xlapp = createobject etc...

record a macro to do select all and set font to black....

get xlapp to open the saved file,
then do a with xlapp and paste in the macro...

can provide code if required.
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 35025579
http://support.microsoft.com/kb/247412

Dim oExcel As Object
   Dim oBook As Object
   Dim oSheet As Object

   'Start a new workbook in Excel
   Set oExcel = CreateObject("Excel.Application")
   Set oBook = oExcel.Workbooks.Add


   'Add data to cells of the first worksheet in the new workbook
   Set oSheet = oBook.Worksheets(1)
   oSheet.Range("A1").Value = "Last Name"
   oSheet.Range("B1").Value = "First Name"
   oSheet.Range("A1:B1").Font.Bold = True
   oSheet.Range("A2").Value = "Doe"
   oSheet.Range("B2").Value = "John"

   'Save the Workbook and Quit Excel
   oBook.SaveAs "C:\Book1.xls"
   oExcel.Quit
0
 
LVL 15

Accepted Solution

by:
Simon Ball earned 500 total points
ID: 35025598
so here is a marco to open a file, change font and colour of the used range...

    Workbooks.Open Filename:= _
        "C:\Documents and Settings\sball\My Documents\Book1font.xls"
    ActiveWorkbook.UsedRange.Select
    With Selection.Font
        .Name = "Arial"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
   
        With Selection.Font
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
    End With
    With Selection.Font
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 4.99893185216834E-02
    End With

   
    ActiveWorkbook.Save
End Sub
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 15

Expert Comment

by:Simon Ball
ID: 35025606
then you can put the excel change code inside the automation to make changes to the spreadsheet
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 35025650
0
 

Author Comment

by:shaz0503
ID: 35185414
Apologies for no action on this one - have been busy with other 'stuff'.  Hope to get to this next week.....

rgds

S
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question