Book.Save("c:\reports\test.xls")
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("c:\reports\test.xls")
Dim st As XLS.Sheet = Book.Sheets(0)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
Rg.EntireColumn.AutoFit
If st.Cols(4).Width > st.Cols(5).Width Then
st.Cols(5).Width = st.Cols(4).Width
Else
st.Cols(4).Width = st.Cols(5).Width
End If
App.Visible = True
4列和5列,哪个宽,取哪列,但没有效果,应该怎么写?
既然使用vba打开了就不能在使用
XLS.Book,只能使用vba设置,比如:
http://www.foxtable.com/webhelp/topics/2121.htm
Rg.ColumnWidth = 20 '列宽20磅