partham
Active member
Dear Sir,
I am required to sort worksheets of data in a workbook using the same column as key. My application is in VB.Net and I am using Excel Interop. I found this function Excel.Range.Sort to wort the data. However, I do not know what I need to pass as an argunemt for Type. No matter what I try, I get the error, "Type mismatch".
l_strRange = GetWorksheetColumnName(1) + "1:" + GetWorksheetColumnName(l_dtblData.Columns.Count - 1) + CType(l_srlWorkSheetRowCounter.GetByIndex(l_sCtr), Integer).ToString
l_objDataRange = l_objWorksheet.Range(l_strRange)
l_objDataRange.Select()
l_objDataRange.Sort(l_objKeyRange(0), Excel.XlSortOrder.xlAscending, l_objKeyRange(1), GetType(Object), Excel.XlSortOrder.xlAscending, l_objKeyRange(2), Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlYes, 1, True, Excel.XlSortOrientation.xlSortColumns)
Please advise.
Rehards,
I am required to sort worksheets of data in a workbook using the same column as key. My application is in VB.Net and I am using Excel Interop. I found this function Excel.Range.Sort to wort the data. However, I do not know what I need to pass as an argunemt for Type. No matter what I try, I get the error, "Type mismatch".
l_strRange = GetWorksheetColumnName(1) + "1:" + GetWorksheetColumnName(l_dtblData.Columns.Count - 1) + CType(l_srlWorkSheetRowCounter.GetByIndex(l_sCtr), Integer).ToString
l_objDataRange = l_objWorksheet.Range(l_strRange)
l_objDataRange.Select()
l_objDataRange.Sort(l_objKeyRange(0), Excel.XlSortOrder.xlAscending, l_objKeyRange(1), GetType(Object), Excel.XlSortOrder.xlAscending, l_objKeyRange(2), Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlYes, 1, True, Excel.XlSortOrientation.xlSortColumns)
Please advise.
Rehards,