I have two columns of data that I wish to sort. The code I have used gives me an error of;
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Exception from HRESULT: 0x800A03EC
The code worked okay when I was using early binding!
Data looks like this in columns A and B before sorting
1 Alan Wicks
9 Alan Wicks
10 Alan Wicks
1 Bernard McTernan
9 Bernard McTernan
1 Bob Horne
2 Bob Horne
3 Bob Horne
What I have tried:
Imports System
Imports System.IO
Imports System.Xml
Imports System.Data.OleDb
Public Const dbAscending = 1
Public Const dbSortNormal = 0
Public Const dbSortColumns = 3
Public Const dbYes = 1
oSheet.Range(oSheet.Cells(a, 1), oSheet.Cells(b, 2)).Sort(
Key1:=oSheet.Columns(1), Order1:=dbAscending,
Key2:=oSheet.Columns(2), Order2:=dbAscending,
Header:=dbYes,
OrderCustom:=1, MatchCase:=False,
Orientation:=dbSortColumns,
DataOption1:=dbSortNormal,
DataOption2:=dbSortNormal)