View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default formatting ms access to ms excel report

Hi,

You'll have to apply the formatting in your code yourself, you can't make
the export do it automatically. For instance:

Dim wb As Workbook
Set wb = Workbooks.Open("C:\Test.xls")

Dim ws As Worksheet
Set ws = wb.Worksheets("Sheet1")

ws.Columns("A:A").NumberFormat = "#,##0.00;"

Will open a file called test.xls saved at root C, and then in "Sheet1" will
set the number format to two decimal places in column A.

The green signs are likely to be caused by excel viewing the numbers as text
- if hover over them with the mouse it'll say "Number stored as text" - you
can use code to correct this too eg ws.range("a1").value =
cdbl(ws.range("a1").value)

Sam


"Imran Ghani" wrote:

Hi! I am exporting my report from ms access to ms excel with the help of
command:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"qryunionpayinv", "D:\My Reports\banking.xls", True
I am not having the exported data in the desired currency format of
"000.00", nd a small green sign is also coming with the data. Kindly guide me
about how to export the data with the desired format, and of course, w/o the
green sign, as well, I also want to have the total of the number field at the
end of the records.
Kindly guide me about how to achieve my task successfully in excel.
Regards,
Imran.