Dim App As New MSExcel.Application
App.Visible = True
Dim outwb As MSExcel.Workbook = App.WorkBooks.Open(dlg.FileName)
Dim mysheet As MSExcel.WorkSheet = outwb.WorkSheets("明细")
mysheet.SplitColumn = 0 '拆分0列
mysheet.SplitRow = 1 '拆分首行
mysheet.FreezePanes = True '冻结拆分窗口
mysheet.Range("1:1").AutoFilter '筛选
以上是打开一个Excel文件,冻结首行,然后筛选。倒数4四行是录制宏改编的,但是foxtable无法执行,请教专家怎么改动,谢谢!
Dim App As New MSExcel.Application
Try
Dim outwb As MSExcel.Workbook = App.WorkBooks.Open("D:\问题\123.xls")
Dim mysheet As MSExcel.WorkSheet = outwb.WorkSheets(1)
mysheet.Activate()
mysheet.Range("A2").Select() ' 选择的单元格下移一位,从而不冻结首行
App.ActiveWindow.FreezePanes = True
mysheet.Range("A1").AutoFilter(1) '筛选
App.Visible = True
Catch ex As Exception
Output.Show(ex.Message)
End Try