Hi guys,
Basically I'd like to arrange Excel sheets in alphabetical order using vb.net.
In this code:
I tried converting the code from the macro for sorting Excel sheets but this line:
....is not the correct convention on comparing the alphabetical order of the sheets. What is the correct method? It seems that for the Office Interop, when I tried typing whatever the "inheritance" system spews out via IntelliSense didn't happen.
Thanks guys!
Vizier87
Basically I'd like to arrange Excel sheets in alphabetical order using vb.net.
In this code:
vb.net Code:
Dim xlApp As Object = CreateObject("Excel.Application") Dim xlBook As Object = xlApp.Workbooks.Open(TextBox1.Text) For i As Integer = 1 To xlBook.Worksheets.Count If xlBook.Worksheets(i + 1).Name < xlBook.Worksheets(i).Name Then xlApp.Worksheets(i + 1).Move(Before:=xlBook.Worksheets(i)) End If Next
I tried converting the code from the macro for sorting Excel sheets but this line:
vb.net Code:
If xlBook.Worksheets(i + 1).Name < xlBook.Worksheets(i).Name
....is not the correct convention on comparing the alphabetical order of the sheets. What is the correct method? It seems that for the Office Interop, when I tried typing whatever the "inheritance" system spews out via IntelliSense didn't happen.
Thanks guys!
Vizier87