Set exlapp = New Excel.Application
exlapp.Workbooks.Open App.Path & "\book.xlt"
Dim rows As Integer
'将数据信息添加到Excel
For rows = 1 To Form6.zuihyh Step 1
With exlapp.Sheets(1)
.Cells(rows + 1, 1) = MSHFlexGrid1.TextMatrix(rows, 0)
.Cells(rows + 1, 2) = MSHFlexGrid1.TextMatrix(rows, 1)
.Cells(rows + 1, 3) = MSHFlexGrid1.TextMatrix(rows, 2)
.Cells(rows + 1, 4) = MSHFlexGrid1.TextMatrix(rows, 3)
.Cells(rows + 1, 5) = MSHFlexGrid1.TextMatrix(rows, 4)
.Cells(rows + 1, 6) = MSHFlexGrid1.TextMatrix(rows, 5)
.Cells(rows + 1, 7) = MSHFlexGrid1.TextMatrix(rows, 6)
.Cells(rows + 1, 8) = MSHFlexGrid1.TextMatrix(rows, 7)
End With
Next
exlapp.Visible = True
End Sub我想问的是怎么用程序来指定EXCEL的列宽??
exlapp.Workbooks.Open App.Path & "\book.xlt"
Dim rows As Integer
'将数据信息添加到Excel
For rows = 1 To Form6.zuihyh Step 1
With exlapp.Sheets(1)
.Cells(rows + 1, 1) = MSHFlexGrid1.TextMatrix(rows, 0)
.Cells(rows + 1, 2) = MSHFlexGrid1.TextMatrix(rows, 1)
.Cells(rows + 1, 3) = MSHFlexGrid1.TextMatrix(rows, 2)
.Cells(rows + 1, 4) = MSHFlexGrid1.TextMatrix(rows, 3)
.Cells(rows + 1, 5) = MSHFlexGrid1.TextMatrix(rows, 4)
.Cells(rows + 1, 6) = MSHFlexGrid1.TextMatrix(rows, 5)
.Cells(rows + 1, 7) = MSHFlexGrid1.TextMatrix(rows, 6)
.Cells(rows + 1, 8) = MSHFlexGrid1.TextMatrix(rows, 7)
End With
Next
exlapp.Visible = True
End Sub我想问的是怎么用程序来指定EXCEL的列宽??
请问这个"A:A"是什么含义啊??
Selection.ColumnWidth = 10
实现的效果就是第D列的列宽变为10