【Word VBA】簡易文書解析マクロ▽ソースコード
Option Explicit
Option Base 0
'
Public Sub 簡易文書解析マクロ()
Dim Ip As Integer, intDcn() As Integer
Dim varKwd As Variant, strMsg As String
'
'キーワード設定
varKwd = Array("", "、", "。", "日本", "国民")
ReDim intDcn(UBound(varKwd, 1))
'
'カウンタークリア
For Ip = LBound(intDcn, 1) To UBound(intDcn, 1)
intDcn(Ip) = 0
Next Ip
'
With ActiveDocument
'*総文字数取得
intDcn(0) = .Range.ComputeStatistics(wdStatisticCharacters)
'*キーワードの出現数取得
For Ip = 1 To UBound(intDcn, 1)
With .Range(0, 0).Find
.MatchFuzzy = False
.MatchWildcards = True
.Text = CStr(varKwd(Ip))
Do
0