|
楼主 |
发表于 2013-7-22 23:02
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
banjinjiu 发表于 2013-7-22 22:04
大侠,我做了Word文档,代码有问题,请指教:
1、能查看Word文档里有几个表格。
2、每个表格有几行,几列 ... - Sub 表格()
- Dim shtCount As Long
- Dim vIndex As Long, lngRowC As Long, lngColumnC As Long, strTmp As String, strTmp2 As String
- Dim vTab As Table
- With ThisDocument
- shtCount = .Tables.Count
- For Each vTab In .Tables
- vIndex = vIndex + 1
- lngRowC = vTab.Rows.Count
- lngColumnC = vTab.Columns.Count
- strTmp = vTab.Cell(1, 1).Range.Text '这里设置第几行几列
- strTmp2 = "该文档共有a张表,第b张表共c行d列,第1行第1列内容为" & strTmp
- strTmp2 = Replace$(strTmp2, "a", CStr(shtCount))
- strTmp2 = Replace$(strTmp2, "b", CStr(vIndex))
- strTmp2 = Replace$(strTmp2, "c", CStr(lngRowC))
- strTmp2 = Replace$(strTmp2, "d", CStr(lngColumnC))
- MsgBox strTmp2, vbInformation + vbOKOnly, "Eersoft-提示"
- Next
- End With
- End Sub
复制代码 |
|