| 
    
     |  | これも「Word2002 300の技」に検索のヒントだけが載っていたのですが、 私流に考えて、以下のようなマクロになりました。
 全角カタカナの後に続く「・」「ー」(中点・長音符)を半角に変換する処理と、
 Officeアシスタントによる「OK・キャンセル」ボタン処理を付け足しました。
 (但し、このボタン処理は「KatakanaHalfWidth」を実行した場合。
 御不要な場合は「KatakanaHalfWidthExec」のみ実行して下さい。)
 尚、「‐」「ヽ」「ヾ」(ハイフン・カタカナ繰り返し記号)は、
 該当する半角文字がないため変換しません。
 
 Sub KatakanaHalfWidth()
 ' 全角カタカナを半角に変換一括変換
 ' 記録日 2003/01/27 記録者 Shinopy
 Dim bBeforeRunVisible As Boolean
 Dim iLabelValue As Integer
 '
 bBeforeRunVisible = Assistant.Visible
 '
 With Assistant
 .Visible = True
 End With
 '
 With Assistant.NewBalloon
 .Animation = msoAnimationWritingNotingSomething
 .BalloonType = msoBalloonTypeButtons
 .Icon = msoIconAlertQuery
 .Button = msoButtonSetOkCancel
 .Heading = vbCr + "全角カタカナを半角に" + vbCr + "一括変換"
 .Text = "ボタンを選択して下さい。"
 iLabelValue = .Show
 End With
 '
 Select Case iLabelValue
 Case -1 ' [OK]ボタン時
 Call KatakanaHalfWidthExec
 Case -2 ' [キャンセル]ボタン時
 With Assistant
 .Animation = msoAnimationIdle
 End With
 End Select
 '
 With Assistant.NewBalloon
 If iLabelValue = -2 Then
 .Text = "処理が取り消されました。"
 .Animation = msoAnimationGetAttentionMajor
 .Icon = msoIconAlert
 Else
 .Text = "処理が終了しました。"
 .Animation = msoAnimationCharacterSuccessMajor
 .Icon = msoIconAlertInfo
 End If
 .BalloonType = msoBalloonTypeButtons
 .Button = msoButtonSetOK
 .Heading = vbCr + "全角カタカナを半角に" + vbCr + "一括変換"
 .Show
 End With
 Assistant.NewBalloon.Close
 Assistant.Visible = bBeforeRunVisible
 End Sub ' KatakanaHalfWidth  *----*----*
 Sub KatakanaHalfWidthExec()
 ' 記録日 2003/01/27 記録者 Shinopy
 ' 「‐」「ヽ」「ヾ」(連字符・繰り返し記号)は、変換しません。
 Dim cKatakana As String
 cKatakana = "[ァ-" & ChrW(Val("&h30FA")) & "]" ' &h30FA : 「ヲ゛」
 ' *----*
 ' 全角カタカナの後に続く中点・長音符を半角に変換
 Selection.Words(1).Select
 Selection.Collapse wdCollapseStart
 '
 With Selection.Find
 .ClearFormatting
 .Text = cKatakana & "{1,}" & "([・ー]{1,})"
 .Replacement.Text = ""
 .Forward = True
 .Wrap = wdFindContinue
 .Format = False
 .MatchCase = False
 .MatchWholeWord = False
 .MatchByte = False
 .MatchAllWordForms = False
 .MatchSoundsLike = False
 .MatchFuzzy = False
 .MatchWildcards = True
 End With
 '
 Do While Selection.Find.Execute
 With Selection.Range
 .CharacterWidth = wdWidthHalfWidth
 End With
 Selection.Collapse wdCollapseEnd
 Loop
 ' *----*
 ' 全角カタカナを半角に変換
 Selection.Words(1).Select
 Selection.Collapse wdCollapseStart
 '
 With Selection.Find
 .ClearFormatting
 .Text = cKatakana & "{1,}"
 .Replacement.Text = ""
 .Forward = True
 .Wrap = wdFindContinue
 .Format = False
 .MatchCase = False
 .MatchWholeWord = False
 .MatchByte = False
 .MatchAllWordForms = False
 .MatchSoundsLike = False
 .MatchFuzzy = False
 .MatchWildcards = True
 End With
 '
 Do While Selection.Find.Execute
 With Selection.Range
 .CharacterWidth = wdWidthHalfWidth
 End With
 Selection.Collapse wdCollapseEnd
 Loop
 End Sub ' KatakanaHalfWidthExec  *----*----*
 
 |  |