第一范文网 - 专业文章范例文档资料分享平台

VB中对Excel编程操作实例

来源:用户分享 时间:2025/7/20 7:37:45 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

VB中对Excel编程操作实例

vb excel编程技巧,实例,格式,合并单元格,表格线,页面横向

Dim xlApp As excel.Application Dim xlBook As excel.Workbook Dim xlSheet As excel.Worksheet

Set xlApp = CreateObject(\ Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlBook.Worksheets(1) Dim xRange As excel.Range Dim m5 As String Dim msgss As Boolean 'On Error GoTo 99 With xlSheet

If abcd = True Then tmp2 = \台,\个,\If dataM > 5 Then m5 = \数量:\tmp2 Else m5 = \

.Cells(1, 1).Value = lb1.Caption & m5 & Label15.Caption

.Cells(2, 1).Value = \基本信息\

.Cells(6, 1).Value = \额定性能\

Text1.Text & \.Cells(11, 1).Value = \堵转\

.Columns(1).ColumnWidth = 8 '表格宽度 .Columns(2).ColumnWidth = 18 '表格宽度

'.Range(.Cells(1, 1), .Cells(1, 5)).MergeCells = True '合并 .Range(.Cells(2, 1), .Cells(5, 1)).MergeCells = True '合并单元格

.Range(.Cells(6, 1), .Cells(10, 1)).MergeCells = True '合并单元格

.Range(.Cells(11, 1), .Cells(13, 1)).MergeCells = True '合并单元格

.Range(.Cells(1, 1), .Cells(13, dataM + 2)).Borders.LineStyle = xlContinuous '表格线 .Range(.Cells(2, 1), .Cells(13, dataM + 2)).HorizontalAlignment = xlCenter .Cells(1, 1).Font.Size = 12 .Cells(1, 1).Font.Name = \黑体\.rowS(1).RowHeight = 30'行高 For i = 2 To 13

.rowS(i).RowHeight = 20 Next

For i = 0 To dataM

.Columns(i + 3).ColumnWidth = 15 '表格宽度 If i <> 0 Then .Cells(2, i + 2).Font.Size = 5 .Cells(2, i + 2).Value = Label1(i).Caption

If dataM > 5 And i <> 0 And abcd = True Then .Cells(3, i + 2).Value = Trim(Left(Right(Label1(i).Caption, 7), 3)) Else

.Cells(3, i + 2).Value = Label2(i).Caption End If

If i = 0 Or dataM < 6 Then .Cells(3, i + 2).Value = Label2(i).Caption

.Cells(4, i + 2).Value = Label3(i).Caption .Cells(5, i + 2).Value = Label4(i).Caption .Cells(6, i + 2).Value = Label5(i).Caption .Cells(7, i + 2).Value = Label6(i).Caption .Cells(8, i + 2).Value = Label7(i).Caption .Cells(9, i + 2).Value = Label8(i).Caption .Cells(10, i + 2).Value = Label9(i).Caption .Cells(11, i + 2).Value = Label10(i).Caption .Cells(12, i + 2).Value = Label11(i).Caption .Cells(13, i + 2).Value = Label12(i).Caption Next

搜索更多关于: VB中对Excel编程操作实例 的文档
VB中对Excel编程操作实例.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c64xlz5nxdx5gf8x599ez10e609m87w01b8l_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top