Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:excel哪列宽取哪列

1楼
xxfoxtable 发表于:2024/6/4 13:31:00
            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列,哪个宽,取哪列,但没有效果,应该怎么写?
2楼
有点蓝 发表于:2024/6/4 13:54:00
既然使用vba打开了就不能在使用XLS.Book,只能使用vba设置,比如:http://www.foxtable.com/webhelp/topics/2121.htm

Rg.ColumnWidth = 20   '列宽20磅 
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01172 s, 2 queries.