LoginSignup
0
0

More than 5 years have passed since last update.

Word コマンドマクロの出力、実行

Posted at

そのまえにまた英語しか出ないんだけど何をやっているんだ公式は

Egde+アドインかChromeで日本語が出る

Edgeが最適化といいながらこの状況。しかもたまに翻訳ができない。EdgeもChromeもページ単位だと失敗する場合がある。

Docs / Office VBA Reference / Word / Object Model / Application Objcect Method ListCommands
Application.ListCommands Method (Word)
新しい文書を作成し、Word コマンドおよび関連するショートカット キーとメニューの割り当てのテーブルを挿入します。
Syntax
Application .ListCommand ListAllcommands

Parameter
ListAllCommands 必須 True (-1) ですべてのコマンドとその割り当て、‎‎False‎‎(0)、ユーザー設定の割り当てコマンドだけが含まれます。

Example
‎この例は、すべて Word コマンドおよび関連するショートカット キーとメニューの割り当ての一覧を表示する新しい文書を作成します。印刷し、変更を保存しないで文書を閉じます。

Sub WrietListCommansNewDocument()
'Macroの記録で出力
'For Word
  Application.ListCommands ListAllCommands:=1
  'Application.Run MacroName:="ListCommands" 'コマンド一覧だが、コマンド一覧という名前ではエラーになる
  Windows("文書 2").Activate
  '68ページくらい出力される
  'なので公式は改変
End Sub
Sub PrintOutWordCommandList()
'For Word
Dim wd As Word.Document: Set wd = ThisDocument
Application.ListCommands ListAllCommands:=True
With ActiveDocument
 .PrintOut Background:=True, From:=1, To:=1 '1ページだけ出力されるように調整
 .Close SaveChanges:=wdDoNotSaveChanges
End With

Sub PrintOutWordCommandList()
'For Word
Dim wd As Word.Document: Set wd = ThisDocument
Application.ListCommands ListAllCommands:=True
With ActiveDocument
 .PrintOut Background:=True, From:=1, To:=1 '1ページだけ出力されるように調整
 .Close SaveChanges:=wdDoNotSaveChanges
End With
End Sub

出力が日本語で使えない

こんな感じだが、英語の名前が出ない。英語名がわからないとApplication.runで実行できない。
この時は、英語ではなく、必要な命令をQATに登録しようとして確認する。

コマンド名 補助キー キー
{[LTR マクロ] ダイアログ ボックス
戻る Alt+Ctrl+ Z

参考

How to List All the Commands Available in Word -LifeWire
出力方法はこちらを参考にした。

Wordの「コマンドマクロ」一覧 谷本玲大氏のページ
コマンドマクロ一覧(Word 2013 Customer Preview) 初心者備忘録

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0