|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Oggetto Application di excel in vb net 20032003 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 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. Pierre wrote: Show quoteHide quote > 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 > > |
|||||||||||||||||||||||