Skip to content

Instantly share code, notes, and snippets.

@ooltcloud
Created May 15, 2017 16:06
Show Gist options
  • Save ooltcloud/448cfb1fb8b378c904e25c273aaa0626 to your computer and use it in GitHub Desktop.
Save ooltcloud/448cfb1fb8b378c904e25c273aaa0626 to your computer and use it in GitHub Desktop.
Visio のアクティブドキュメントの全角英数を半角にする
Sub アクティブドキュメントの全角英数を半角にする()
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoChar As Visio.Characters
Dim c As Integer
For Each vsoPage In Application.ActiveDocument.Pages
For Each vsoShape In vsoPage.Shapes
Set vsoChar = vsoShape.Characters
For i = 1 To vsoChar.CharCount
vsoChar.Begin = i - 1
vsoChar.End = i
c = AscW(vsoChar.Text)
If (&HFF01 <= c And c <= &HFF5E) Then ' 全角形の範囲
vsoChar.Text = StrConv(vsoChar.Text, vbNarrow) '半角変換
End If
Next
Next
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment