J
jj
I have earlier posted this mail in Public.access, but without any replies so
now I try here, and hope
Im trying to copy a recordset from access 2003 to excel 2003 using
copyfromrecordset, but when it is pasted into excel it is formated as text
not percentages as it should be. How can I format it back to percentages
from VBA in ms access 2K3.
I post the part of the code where I try to
format it in excel - help is appreciated
Tia
JJ
' Start Excel - using late binding to avoid library problems
Set objXL = CreateObject("Excel.Application")
' Set flag to indicate Excel started OK
intExcelRunning = True
Set objXLBook = objXL.Workbooks.Add
' Save it
objXLBook.SaveAs CurrentProject.Path & "\ChartExample5.xls"
' Point to worksheet
Set objXLSheet = objXLBook.ActiveSheet
' Name it
objXLSheet.Name = "Sales_Data"
' Insert column headings
objXLSheet.Cells(1, 1) = "ww"
objXLSheet.Cells(1, 2) = "Endel"
' Ask Excel to copy the data from the recordset
objXLSheet.Range("A2").CopyFromRecordset rst
' Calculate the end row
intRow = rst.RecordCount + 1
'Set a PERCENT format for COLUMN B TO E
'objXLSheet.Range("B2:e" & intRow).NumberFormat = "0.00%"
now I try here, and hope
Im trying to copy a recordset from access 2003 to excel 2003 using
copyfromrecordset, but when it is pasted into excel it is formated as text
not percentages as it should be. How can I format it back to percentages
from VBA in ms access 2K3.
I post the part of the code where I try to
format it in excel - help is appreciated
Tia
JJ
' Start Excel - using late binding to avoid library problems
Set objXL = CreateObject("Excel.Application")
' Set flag to indicate Excel started OK
intExcelRunning = True
Set objXLBook = objXL.Workbooks.Add
' Save it
objXLBook.SaveAs CurrentProject.Path & "\ChartExample5.xls"
' Point to worksheet
Set objXLSheet = objXLBook.ActiveSheet
' Name it
objXLSheet.Name = "Sales_Data"
' Insert column headings
objXLSheet.Cells(1, 1) = "ww"
objXLSheet.Cells(1, 2) = "Endel"
' Ask Excel to copy the data from the recordset
objXLSheet.Range("A2").CopyFromRecordset rst
' Calculate the end row
intRow = rst.RecordCount + 1
'Set a PERCENT format for COLUMN B TO E
'objXLSheet.Range("B2:e" & intRow).NumberFormat = "0.00%"