Sub EspOptions() Rem *----*----* *----*----* *----*----* *----*----* Rem エスペラント語関連マクロ群ツールバー表示処理 Rem 作譜:Hitrock Camellia Shinopy Rem 言語:Word VBA Rem 機能... Rem 1. エスペラント語関連マクロ群 Rem 2. [選択範囲の自動調整オプションの指定][字下げの指定:スペース文字/インデント] Rem 3. 「EspIndexXe」を実行するコマンドボタンを表示する。 Rem 4. 文書校正の機能(文書校正・オートコレクト)を設定するコマンドボタンを表示する。 Rem 5. コマンドボタンを押して操作する。 Rem 注記... Rem 1. 「EspOptions」を起動して、ツールバーを追加し、コマンドボタンを押して、処理を実行する。 Rem 2. エスペラント文の入力時は、文書校正・オートコレクトは停止しておく必要がある。 Rem 文書校正の機能(文書校正・オートコレクト)のコマンドボタンを押して設定できる。 Rem 3. EspIndexXe[蛍光ペン書式文字列 索引登録処理]を使う場合は、このマクロを導入しておくこと。 Rem 4. EspDialogReplace[エスペラント語 [検索と置換]ダイアログボックス表示処理]を使う場合は、このマクロを導入しておくこと。 Rem 履歴... Rem 第01版:2010/02/07 作成。 Rem 第02版:2010/03/01 コマンドボタンの操作を変更。 Rem 第02版:2010/05/05 [蛍光ペン書式文字列 索引登録処理]ボタンを追加。 Rem 第03版:2010/10/07 [エスペラント語 [検索と置換]ダイアログボックス表示処理]ボタンを追加。 Rem 第04版:2011/05/07 [EspNxcf][EspLoop]廃止。[選択範囲の自動調整オプションの指定][字下げの指定:スペース文字/インデント]追加。 Rem 第05版:2011/06/19 TooltipText表示を変更。 Rem 第06版:2015/01/25 [入力時にスペル チェックを行う]ボタンを追加。 Rem 第07版:2018/09/17 [使用言語による文章校正の指定]ボタンを追加。 Rem *----*----* *----*----* *----*----* *----*----* Dim myTitle As String Rem *----*----* *----*----* *----*----* *----*----* ' Rem 既定値の設定 myTitle = "EspOptions" Rem *----*----* *----*----* *----*----* *----*----* ' Rem 同名ツールバーの削除 On Error Resume Next CommandBars(myTitle).Delete ' On Error GoTo 0 Rem ツールバー表示処理 Dim myCmmdBar As CommandBar Dim myBttnLanguage As CommandBarControl Dim myBttnParaWordSelection As CommandBarControl Dim myBttnAutoApplyIndent As CommandBarControl Dim myBttnEspIndexXe As CommandBarControl Dim myBttnCheckSpellingAsYouType As CommandBarControl Dim myBttnCheckGrammarAsYouType As CommandBarControl Dim myBttnCheckGrammarWithSpelling As CommandBarControl Dim myBttnAutoCorrectReplaceText As CommandBarControl Dim myBttnEspDialogReplace As CommandBarControl Dim myBttnPaste As CommandBarControl Rem *----*----* *----*----* *----*----* *----*----* ' Set myCmmdBar = CommandBars.Add(Name:=myTitle, Position:=msoBarTop, Temporary:=True) ' Set myBttnLanguage = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=1, Temporary:=True) Set myBttnParaWordSelection = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=2, Temporary:=True) Set myBttnAutoApplyIndent = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=3, Temporary:=True) Set myBttnEspIndexXe = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=4, Temporary:=True) Set myBttnCheckSpellingAsYouType = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=5, Temporary:=True) Set myBttnCheckGrammarAsYouType = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=6, Temporary:=True) Set myBttnCheckGrammarWithSpelling = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=7, Temporary:=True) Set myBttnAutoCorrectReplaceText = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=8, Temporary:=True) Set myBttnEspDialogReplace = myCmmdBar.Controls.Add(Type:=msoControlButton, Before:=9, Temporary:=True) Set myBttnPaste = myCmmdBar.Controls.Add(Type:=msoControlButton, ID:=755, Before:=10, Temporary:=True) Rem *----*----* *----*----* *----*----* *----*----* ' With myBttnLanguage .DescriptionText = "使用言語による文章校正の指定" .Style = msoButtonIcon .Caption = "使用言語による文章校正の指定" .OnAction = "EspOptionsBttnLanguage" Call EspOptionsBttnLanguage(True) End With ' With myBttnParaWordSelection .DescriptionText = "[文字列の選択時に単語単位で選択する][段落の選択範囲を自動的に調整する]" .Style = msoButtonIcon .Caption = "選択範囲の自動調整オプションの指定" .OnAction = "EspOptionsParaWordSelection" Call EspOptionsParaWordSelection(True) End With ' With myBttnAutoApplyIndent .DescriptionText = "[行の始まりのスペースを字下げに変更する][Tab/Space/BackSpaceキーでインデントとタブの設定を変更する]" .Style = msoButtonIcon .Caption = "字下げの指定:スペース文字/インデント" .OnAction = "EspOptionsAutoApplyIndent" Call EspOptionsAutoApplyIndent(True) End With ' With myBttnEspIndexXe .DescriptionText = "EspIndexXeを実行する。" .Style = msoButtonIcon .Caption = "EspIndexXe" .TooltipText = "蛍光ペン書式文字列 索引登録処理(エスペラント文字並び順対応)" .FaceId = 2293 .OnAction = "EspIndexXe" End With ' With myBttnCheckSpellingAsYouType .DescriptionText = "エスペラント語関連マクロ群ツールバー表示処理" .Style = msoButtonIcon .Caption = "入力時にスペル チェックを行う" .OnAction = "EspOptionsCheckSpellingAsYouType" Call EspOptionsCheckSpellingAsYouType(True) End With ' With myBttnCheckGrammarAsYouType .DescriptionText = "エスペラント語関連マクロ群ツールバー表示処理" .Style = msoButtonIcon .Caption = "自動文書校正" .OnAction = "EspOptionsCheckGrammarAsYouType" Call EspOptionsCheckGrammarAsYouType(True) End With ' With myBttnCheckGrammarWithSpelling .DescriptionText = "エスペラント語関連マクロ群ツールバー表示処理" .Style = msoButtonIcon .Caption = "文書校正とスペルチェックを一緒に行う" .OnAction = "EspOptionsCheckGrammarWithSpelling" Call EspOptionsCheckGrammarWithSpelling(True) End With ' With myBttnAutoCorrectReplaceText .DescriptionText = "エスペラント語関連マクロ群ツールバー表示処理" .Style = msoButtonIcon .Caption = "オートコレクト:入力中に自動修正する" .OnAction = "EspOptionsAutoCorrectReplaceText" Call EspOptionsAutoCorrectReplaceText(True) End With ' With myBttnEspDialogReplace .DescriptionText = "EspDialogReplaceを実行する。" .Style = msoButtonIcon .Caption = "EspDialogReplace" .TooltipText = "エスペラント語 [検索と置換]ダイアログボックス表示処理" .FaceId = 564 .OnAction = "EspDialogReplace" End With ' myCmmdBar.Visible = True End Sub ' EspOptions *----*----* *----*----* *----*----* *----*----* Sub EspOptionsBttnLanguage(Optional myDummy As Boolean) Dim c As String Dim s As String ' c = "使用言語による文章校正の指定" ' If myDummy = False Then Select Case CommandBars("EspOptions").Controls(c).FaceId Case 5957 Options.CheckSpellingAsYouType = False Options.CheckGrammarAsYouType = False Options.CheckGrammarWithSpelling = False AutoCorrect.ReplaceText = False Case 6735 ' 6914 Options.CheckSpellingAsYouType = True Options.CheckGrammarAsYouType = True Options.CheckGrammarWithSpelling = True AutoCorrect.ReplaceText = True Case Else Options.CheckSpellingAsYouType = True Options.CheckGrammarAsYouType = True Options.CheckGrammarWithSpelling = True AutoCorrect.ReplaceText = True End Select Beep End If ' s = CStr(Options.CheckSpellingAsYouType) & " " & CStr(Options.CheckGrammarAsYouType) & " " s = s & CStr(Options.CheckGrammarWithSpelling) & " " & CStr(AutoCorrect.ReplaceText) Select Case s Case "True True True True" CommandBars("EspOptions").Controls(c).FaceId = 5957 CommandBars("EspOptions").Controls(c).TooltipText = "[日本語]設定!" Case "False False False False" CommandBars("EspOptions").Controls(c).FaceId = 6735 ' 6914 CommandBars("EspOptions").Controls(c).TooltipText = "[エスペラント語]設定!" Case Else CommandBars("EspOptions").Controls(c).FaceId = 463 CommandBars("EspOptions").Controls(c).TooltipText = "[使用言語による文章校正の指定]未決!" End Select ' If myDummy = False Then Call EspOptionsCheckSpellingAsYouType(True) Call EspOptionsCheckGrammarAsYouType(True) Call EspOptionsCheckGrammarWithSpelling(True) Call EspOptionsAutoCorrectReplaceText(True) End If End Sub ' EspOptionsBttnLanguage *----*----* *----*----* *----*----* *----*----* Sub EspOptionsParaWordSelection(Optional myDummy As Boolean) Dim c As String ' c = "選択範囲の自動調整オプションの指定" ' If myDummy = False Then Select Case CStr(Options.AutoWordSelection) & " " & CStr(Options.SmartParaSelection) Case "True True" Options.AutoWordSelection = False Options.SmartParaSelection = True Case "False False" Options.AutoWordSelection = True Options.SmartParaSelection = True Case Else Options.AutoWordSelection = False Options.SmartParaSelection = False End Select Beep End If ' Select Case CStr(Options.AutoWordSelection) & " " & CStr(Options.SmartParaSelection) Case "True True" CommandBars("EspOptions").Controls(c).FaceId = 1715 CommandBars("EspOptions").Controls(c).TooltipText = "[選択範囲の自動調整オプション]設定!" Case "False False" CommandBars("EspOptions").Controls(c).FaceId = 1716 CommandBars("EspOptions").Controls(c).TooltipText = "[選択範囲の自動調整オプション]解除。" Case Else CommandBars("EspOptions").Controls(c).FaceId = 463 CommandBars("EspOptions").Controls(c).TooltipText = "[選択範囲の自動調整オプション]初期値!" End Select End Sub ' EspOptionsParaWordSelection *----*----* *----*----* *----*----* *----*----* Sub EspOptionsAutoApplyIndent(Optional myDummy As Boolean) Dim c As String ' c = "字下げの指定:スペース文字/インデント" ' If myDummy = False Then Select Case CStr(Options.TabIndentKey) & " " & CStr(Options.AutoFormatAsYouTypeApplyFirstIndents) Case "True True" Options.TabIndentKey = True Options.AutoFormatAsYouTypeApplyFirstIndents = False Case "False False" Options.TabIndentKey = True Options.AutoFormatAsYouTypeApplyFirstIndents = True Case Else Options.TabIndentKey = False Options.AutoFormatAsYouTypeApplyFirstIndents = False End Select Beep End If ' Select Case CStr(Options.TabIndentKey) & " " & CStr(Options.AutoFormatAsYouTypeApplyFirstIndents) Case "True True" CommandBars("EspOptions").Controls(c).FaceId = 1715 CommandBars("EspOptions").Controls(c).TooltipText = "[字下げの指定:インデント]設定!" Case "False False" CommandBars("EspOptions").Controls(c).FaceId = 1716 CommandBars("EspOptions").Controls(c).TooltipText = "[字下げの指定:スペース文字]解除。" Case Else CommandBars("EspOptions").Controls(c).FaceId = 463 CommandBars("EspOptions").Controls(c).TooltipText = "[字下げの指定:スペース文字]初期値!" End Select End Sub ' EspOptionsAutoApplyIndent *----*----* *----*----* *----*----* *----*----* Sub EspOptionsCheckSpellingAsYouType(Optional myDummy As Boolean) Dim c As String ' c = "入力時にスペル チェックを行う" If myDummy = False Then Options.CheckSpellingAsYouType = Not Options.CheckSpellingAsYouType Call EspOptionsBttnLanguage(True) Beep End If ' If Options.CheckSpellingAsYouType = True Then CommandBars("EspOptions").Controls(c).FaceId = 1715 CommandBars("EspOptions").Controls(c).TooltipText = "[入力時にスペル チェックを行う]設定!" Else CommandBars("EspOptions").Controls(c).FaceId = 1716 CommandBars("EspOptions").Controls(c).TooltipText = "[入力時にスペル チェックを行う]解除。" End If End Sub ' EspOptionsCheckSpellingAsYouType *----*----* *----*----* *----*----* *----*----* Sub EspOptionsCheckGrammarAsYouType(Optional myDummy As Boolean) Dim c As String Dim d As String ' c = "自動文書校正" d = "文書校正とスペルチェックを一緒に行う" If myDummy = False Then Options.CheckGrammarAsYouType = Not Options.CheckGrammarAsYouType Call EspOptionsBttnLanguage(True) Beep End If ' If Options.CheckGrammarAsYouType = True Then CommandBars("EspOptions").Controls(c).FaceId = 2 CommandBars("EspOptions").Controls(c).TooltipText = "[自動文書校正]設定!" ' Options.CheckGrammarWithSpelling = True On Error Resume Next CommandBars("EspOptions").Controls(d).FaceId = 2 CommandBars("EspOptions").Controls(d).TooltipText = "[文書校正とスペルチェックを一緒に行う]設定!" On Error GoTo 0 Else CommandBars("EspOptions").Controls(c).FaceId = 305 CommandBars("EspOptions").Controls(c).TooltipText = "[自動文書校正]解除。" End If End Sub ' EspOptionsCheckGrammarAsYouType *----*----* *----*----* *----*----* *----*----* Sub EspOptionsCheckGrammarWithSpelling(Optional myDummy As Boolean) Dim c As String ' c = "文書校正とスペルチェックを一緒に行う" ' If myDummy = False Then Options.CheckGrammarWithSpelling = Not Options.CheckGrammarWithSpelling Call EspOptionsBttnLanguage(True) Beep End If ' If Options.CheckGrammarWithSpelling = True Then CommandBars("EspOptions").Controls(c).FaceId = 2 CommandBars("EspOptions").Controls(c).TooltipText = "[文書校正とスペルチェックを一緒に行う]設定!" Else CommandBars("EspOptions").Controls(c).FaceId = 305 CommandBars("EspOptions").Controls(c).TooltipText = "[文書校正とスペルチェックを一緒に行う]解除。" End If End Sub ' EspOptionsCheckGrammarWithSpelling *----*----* *----*----* *----*----* *----*----* Sub EspOptionsAutoCorrectReplaceText(Optional myDummy As Boolean) Dim c As String ' c = "オートコレクト:入力中に自動修正する" If myDummy = False Then AutoCorrect.ReplaceText = Not AutoCorrect.ReplaceText Call EspOptionsBttnLanguage(True) Beep End If ' If AutoCorrect.ReplaceText = True Then CommandBars("EspOptions").Controls(c).FaceId = 1715 CommandBars("EspOptions").Controls(c).TooltipText = "[オートコレクト:入力中に自動修正する]設定!" Else CommandBars("EspOptions").Controls(c).FaceId = 1716 CommandBars("EspOptions").Controls(c).TooltipText = "[オートコレクト:入力中に自動修正する]解除。" End If End Sub ' EspOptionsAutoCorrectReplaceText *----*----* *----*----* *----*----* *----*----*

inserted by FC2 system