例如,1)定義陣列arr(0 To 9)
2)采用通配符查找字串 “數字1~9”&“任意中文字符”
查找特定字符命令
With Selection.find
.Text = "[0-9][!^1-^127]"
.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.find.Execute
那么問題來了,如何將查找到的特定字串賦值給陣列arr(0 To 9)呢?在線等
uj5u.com熱心網友回復:
不知道Split函式可不可以解決你的問題uj5u.com熱心網友回復:
With Selection.Find
.Text = "[0-9][!^1-^127]"
.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
.Wrap = wdFindStop '讓查詢不要回圈
End With
Do
Selection.Find.Execute
If Selection.Find.Found Then
Debug.Print Selection.Text
'這里在立即視窗列印出搜索到的字串
'加到陣列的事情自己做
Else
Exit Do
'搜索完最后一個退出
End If
DoEvents
Loop
uj5u.com熱心網友回復:
大神,你這個好像是列印文本吧,但如何把相應文本賦值到陣列中好像沒寫出來
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/38681.html
標籤:VBA
