johnnyg123
asked on
Ignore error checking in vba
I have an access 2003 application that is copying data from a recordset to an excel application opend in the background using the following
Dim appExcel As Excel.Application
Dim wbk As Excel.Workbook
Dim wks As Excel.Worksheet
All seems to be working well except some of the data is resulting in excel displaying the little green triangle indicating a data format error.
I was trying to set a property that would prevent this from happening but can't seem to get the correct format.
Below is the code that loops through the addition of the fields to the excel spreadsheet
The wks.Cells(iRow, iCol).Errors.Item(xlNumber AsText).Ig nore = True is resulting in an object not set error
For iCol = cStartColumn To cStartColumn + (rst.Fields.Count - 1)
wks.Cells(iRow, iCol) = rst.Fields(iFld)
wks.Cells(iRow, iCol).WrapText = True
wks.Cells(iRow, iCol).Errors.Item(xlNumber AsText).Ig nore = True
wks.Rows(iRow).VerticalAli gnment = xlTop
iFld = iFld + 1
Next
any ideas?
Dim appExcel As Excel.Application
Dim wbk As Excel.Workbook
Dim wks As Excel.Worksheet
All seems to be working well except some of the data is resulting in excel displaying the little green triangle indicating a data format error.
I was trying to set a property that would prevent this from happening but can't seem to get the correct format.
Below is the code that loops through the addition of the fields to the excel spreadsheet
The wks.Cells(iRow, iCol).Errors.Item(xlNumber
For iCol = cStartColumn To cStartColumn + (rst.Fields.Count - 1)
wks.Cells(iRow, iCol) = rst.Fields(iFld)
wks.Cells(iRow, iCol).WrapText = True
wks.Cells(iRow, iCol).Errors.Item(xlNumber
wks.Rows(iRow).VerticalAli
iFld = iFld + 1
Next
any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
'Possible values of xlErrorChecks
'xlEvaluateToError = 1
'xlTextDate = 2
'xlNumberAsText = 3
'xlOmittedCells = 5
'xlUnlockedFormulaCells = 6
'xlEmptyCellReferences = 7
wks.Cells(iRow, iCol).Errors.Item(xlEvalua
wks.Cells(iRow, iCol).Errors.Item(xlTextDa
wks.Cells(iRow, iCol).Errors.Item(xlNumber
wks.Cells(iRow, iCol).Errors.Item(xlOmitte
wks.Cells(iRow, iCol).Errors.Item(xlUnlock
wks.Cells(iRow, iCol).Errors.Item(xlEmptyC