- UID
- 262220
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-5-19
- 最后登录
- 1970-1-1
|
发表于 2005-5-21 02:45:47
|
显示全部楼层
Set objExlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then Set objExlApp = CreateObject("Excel.Application")
Err.Clear
objExlApp.Application.Visible = True
If objExlApp.workbooks.Count < 1 Then
Set objExlBook = objExlApp.workbooks.Add
Else
Set objExlBook = objExlApp.activeworkbook
End If
Set objExlSheet = objExlBook.activesheet
objExlSheet.cells(RowNum, ColNum) = "需要键入的字符串" '在表格中添加文字
With objExlSheet.range(objExlSheet.cells(1, 1), objExlSheet.cells(5, 3))
.NumberFormatLocal = "###0.00" '可以对数字设格式
End With
objExlSheet.selection.Clear
objExlSheet.range(objExlSheet.cells(1, 1), objExlSheet.cells(5, 4)).RowHeight = 24 '设选择区域行高
objExlSheet.Rows("1:1").RowHeight = 28 '另一种设置方式
objExlSheet.Columns("A:A").ColumnWidth = 100 'l列宽
VB针对Excel的编程可以自己录制宏,参考其语法,稍加调整即可。 |
|