Oggetto Application di excel in vb net 2003

P

Pierre

Scusate ma sono da poco passato a scrivere qualche riga di codice in vb.net
2003

ma non sono stato in grado di ritradurre la riga sulla selection sort e
continua a darmi errore

sull'oggetto application qualcuno è in grado di aiutarmi ?

C'è forse qualche altra istruzione da utilizzare ?



Ringrazio in anticipo per l'interessamento

Dim excelApp As New Excel.Application

Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add

Dim excelWorksheet As Excel.Worksheet = _

CType(excelBook.Worksheets(1), Excel.Worksheet)

With excelWorksheet

.Columns("A:H").Select()

.selection.Sort(Key1:=.Range("C2"), Order1:=.xlAscending,
Header:=.xlYes, _

OrderCustom:=1, MatchCase:=False, Orientation:=.xlTopToBottom, _

DataOption1:=.xlSortNormal)

end with
 
G

Gman

Sembra funzione per me - ma se uso i numeri invece delle enums per gli
constants, per essempio:

.Columns("A:H").Sort(Key1:=.Range("C2"), _
Order1:=1, _
Header:=1, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=1, _
DataOption1:=0)

'xlAscending = 1
'xlYes = 1
'xlTopToBottom = 1
'xlSortNormal = 0

Anche io ho fatto senza il 'select, i.e direttamente sulla rige.

HTH

Perdona il mio italiano.
 
Top