Hey all,
I have a problem with VB.NET and Excel.
I'm creating an Excel sheet which goes fine except for setting the auto filter on:
xlSheet.Range("A3", "R3").AutoFilter()
The message I receive is:Reference to a non-shared member requires an object reference. but all other setting on the sheet work fine.(with reference to the sheet).
Part of my code is:
xlSheet.Activate() 'I have more sheets
xlSheet.Name = Left(chkItem.Text, 4)
xlSheet.Range("A3").Value = "Truck"
xlSheet.Range("B3").Value = "Truck description"
............ and more headings to R3...
With xlSheet.Range("A3", "R3").Font
.Name = "Arial"
.Size = 10
.Bold = True
.Color = RGB(255, 0, 0)
End With
xlSheet.EnableAutoFilter = True
xlSheet.Range("A3", "R3").AutoFilter() 'this one goes wrong
thanks guys.
I have a problem with VB.NET and Excel.
I'm creating an Excel sheet which goes fine except for setting the auto filter on:
xlSheet.Range("A3", "R3").AutoFilter()
The message I receive is:Reference to a non-shared member requires an object reference. but all other setting on the sheet work fine.(with reference to the sheet).
Part of my code is:
xlSheet.Activate() 'I have more sheets
xlSheet.Name = Left(chkItem.Text, 4)
xlSheet.Range("A3").Value = "Truck"
xlSheet.Range("B3").Value = "Truck description"
............ and more headings to R3...
With xlSheet.Range("A3", "R3").Font
.Name = "Arial"
.Size = 10
.Bold = True
.Color = RGB(255, 0, 0)
End With
xlSheet.EnableAutoFilter = True
xlSheet.Range("A3", "R3").AutoFilter() 'this one goes wrong
thanks guys.