Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When I write numbers, dates or currency values to an Excel file using
ADO (VB6) there is a little green mark at the top left of each column indicating there is an error with the data. When I click on the cell I get a small exclamation mark pops up to the left. I click on it and it shows a drop down which provides the following selections: "Number Stored as Text" "Convert to Number" "Help on this Error" "Ignore Error:" "Edit in Formula Bar" "Error Checking Options" "Show Formula Auditing Toolbar" Apparently Excel thinks there is a problem with the data. But all I have to do to correct the problem and get rid of the little green mark at the top left corner of the cell is click in the formula bar and the click out. So there really isn't a problem (the cell is formated as "General" so numbers or dates should work as well as anything else). Here is the code I use. With objConn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source=" & strExcelFile & "; Extended Properties=Excel 8.0" .Open End With rs.Open "select * from [Sheet1$]", objConn, adOpenKeyset, adLockOptimistic mrsPrepaidQuotes.MoveFirst ' mrsPrepaidQuotes is an ado recordset from a mssql2000 db While Not mrsPrepaidQuotes.EOF rs.AddNew rs.Fields("OriginalOrderDate") = DateOnly(mrsPrepaidQuotes! OriginalOrderDate) 'returns a data string "07/07/2006" - Has the little green thing in corner rs.Fields("OriginalS#") = mrsPrepaidQuotes.Fields("OriginalS#").Value ' returns a letter and numbers ' no prob rs.Fields("Quote#") = mrsPrepaidQuotes.Fields("Quote#").Value ' returns a letter and numbers ' no prob rs.Fields("CustomerNumber") = mrsPrepaidQuotes.Fields("CustomerNumber").Value ' returns a number, as green thing rs.Fields("Amt") = FormatCurrency(mrsPrepaidQuotes!Amt) ' return currency string "$100.00" also has green thing rs.Fields("Amt w/Tax") = FormatCurrency(mrsPrepaidQuotes.Fields("Amt w/Tax").Value) return currency string "$100.00" also has green thing mrsPrepaidQuotes.MoveNext Wend rs.Update Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Writing a macro that will exit a spreadsheet | New Users to Excel | |||
VBA UDF Writing data to spreadsheet | Excel Programming | |||
Writing Out Numbers as Text | Excel Programming | |||
Writing bitmap to Excel Spreadsheet | Excel Programming | |||
Writing to a excel spreadsheet is slow. | Excel Programming |