Font in Exported Spreadsheet

millwheal

Registered User.
Local time
Today, 05:49
Joined
Feb 4, 2009
Messages
41
I am using VBA [TransferSpreadSheet] to export a table from an Access 2003 database to Excel 2003.
I have no problems at all with the data, but the resulting spreadsheet has the 'MS Sans Serif' font, whereas the defualt font in Excel is 'Verdana'. I can find no settings in Access or Excel which specify 'MS Sans Serif'. Is there a way of ensuring the font is what I want it to be?
Thanks in anticipation.
millwheal
 
Hi,

In Access choose Tools, Options and then click on the datasheet tab. under default font you'll see a combo box which will list all the fonts available to you. choose your desired font. This will set the default font for your entire database to your chosen font.

John
 
John,
Thanks for the suggestion, but that Option is already set to 'Verdana', yet the spreadsheet still ends up as 'MS Sans Serif'.
millwheal
 
Hi Millwheal,

Then in the spreadsheet, choose tools options, General tab, change the standard font to your desired font, that should resolve it.

John
 
John,
I have already done that [as a 'default'], and I realise I could do it manually once the spreadsheet is created. However, I was hoping to do it automatically as I want to email the spreadsheet to someone else and was hoping to do the whole export/email as part of one, automated procedure.

millwheal
 
You'll need to use the Excel Object model to do this. You will need to open the spreadsheet using code and set the font for the worksheet:

Code:
Dim objXL As Object
Dim xlWB As Object

Set objXL = CreateObject("Excel.Application")
objXL.Visible = True
Set xlWB = objXL.Workbooks.Open("ThePathAndFileNameToYourWorkBook")

With objXL
.Cells.Select

.Selection.Font.Name = "Verdana"
 
Bob,
Many thanks, I can now do exactly what I wanted.

millwheal
 

Users who are viewing this thread

Back
Top Bottom