View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default formatting ms access to ms excel report

change
ws.Range("A1").CurrentRegion

to

ws.Range("B:C").NumberFormat = "0.00;(0.00)"

"Imran Ghani" wrote in message
...
Hi Patrick Molloy,
Thanks for your guidance. I have got my number data in column B and C.
Please guide me about how to give the above range in the following
ws.Range("A1").CurrentRegion
Regards,
Imran.


"Patrick Molloy" wrote:

when data is copied to excel from Access, they're just numbers, so there
is
no formatting. you should open excel and use code to format the data
you can do this with Access VBA too

Sub tester()

Dim xl As Object
Dim wb As Object
Dim ws As Object

Set xl = CreateObject("Excel.Application")
''xl.Visible = True 'not required - use for testing

Set wb = xl.Workbooks.Open("C:\temp\abc.xls")
Set ws = wb.ActiveSheet

ws.Range("A1").CurrentRegion.NumberFormat = "0.00;(0.00)"

'cleanup - must have!!
Set ws = Nothing
wb.Close False
Set wb = Nothing
xl.Quit
Set xl = Nothing

End Sub


"Imran Ghani" wrote in message
...
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.