Word文档里面查多个标签,怎么用VB脚本查

szwm1010 2017-11-28 07:28:02
功能编号:10308001
功能名称:股东查询
功能类型:查询功能
功能入参:
列名 列代码 列类型 必输 FIX域 说明
资产账户 CUACCT_CODE BIGINT √ 8920
交易板块 STKBD VARCHAR(32) X 625
交易账户 TRDACCT VARCHAR(20) X 448
[/b]


Sub 宏_输出Proto文件()
Dim funcId As String
Dim funcName As String
Dim inlineArray(100) As String
Dim retValue As Long
Dim bIsGenrate As Boolean
Dim fileName As String
Dim rowInput As Integer


Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst

' 金证微架构宏_输出Proto文件 宏
Selection.Find.Forward = True
Selection.Find.ClearFormatting
Selection.Find.MatchWholeWord = False
Selection.Find.MatchCase = False
Selection.Find.Wrap = wdFindStop
Selection.Find.Execute FindText:="功能编号:10308"
Do While Selection.Find.Found = True
Char = Selection.EndOf(Unit:=wdWord, Extend:=wdExtend)
funcId = delete_vbcrlf(Selection.Text)
funcId = Mid(funcId, Len(funcId) - 7, 8)

-- 需要循环找文档中10308开头的功能号,解析功能功能编号、功能名称。 现在功能名称找不到
Selection.Find.Execute FindText:="功能类型:"
Selection.Find.Forward = True
If Selection.Find.Found = True Then
Char = Selection.EndOf(Unit:=wdWord, Extend:=wdExtend)
funcName = delete_vbcrlf(Selection.Text)
funcName = Mid(funcId, Len(funcId) - 7, 8)
End If



Char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)
Selection.Find.Execute FindText:="功能编号:10308"
Loop
...全文
345 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2017-11-30
  • 打赏
  • 举报
回复
在Word中开始记录宏,手动完成所需功能,结束记录宏,按Alt+F11键,查看刚才记录的宏对应的VBA代码。

2,462

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧