Wordのオプションから設定できるレイアウトオプションは下記のようなコードで設定できます。
Sub Sample()
ActiveDocument.Compatibility(wdNoTabHangIndent) = True
End Sub
上記コード中のwdNoTabHangIndentはWdCompatibilityクラスのメンバで、各メンバの値と説明は下表の通りです。
WdCompatibilityクラスメンバ一覧
メンバ | 値 | レイアウトオプション項目 |
---|---|---|
wdNoSpaceForUL | 21 | 文字の下に下線のための余分なスペースを挿入する |
wdDontAdjustLineHeightInTable | 36 | 表中では行の高さをグリッド線 (格子)の高さに合わせる |
wdAlignTablesRowByRow | 39 | 表の列を個々に配置する |
wdAllowSpaceOfSameStyleInTable | 54 | 表内で同じスタイルの場合は段落間にスペースを設定する |
wdLayoutTableRowsApart | 41 | 表の列を離して配置する |
wdGrowAutofit | 50 | 表を余白に拡張する |
wdAutospaceLikeWW7 | 38 | Word 95 と同様に文字間隔と文字幅を自動調整する |
wdDontBalanceSingleByteDoubleByteWidth | 16 | 半角文字と全角文字の文字幅を調整する |
wdOrigWordTableRules | 9 | 表の罫線を Word 5.x for the Macintosh のルールで結合する |
wdLeaveBackslashAlone | 13 | バックスラッシュを円記号 (\) に変換する |
wdWPJustification | 31 | WordPerfect 6.x for Windows のルールで両端揃えを行う |
wdNoTabHangIndent | 1 | ぶら下げインデントで自動タブ位置を無視する |
wdNoSpaceRaiseLower | 2 | 上付き文字/下付き文字を表示するための行間を挿入しない |
wdNoLeading | 20 | 文字の上に余分なスペースを挿入しない |
wdDontWrapTextWithPunctuation | 47 | 文字グリッド使用時は句読点のぶら下げを行わない |
wdDontAutofitConstrainedTables | 56 | 折り返しが設定されたオブジェクトの隣の表は、サイズを自動調整しない |
wdNoColumnBalance | 5 | セクションの末尾や文書の末尾で段の長さを調整しない |
wdDontBreakConstrainedForcedTables | 62 | ページに収まらない表の途中で改ページしない |
wdDontBreakWrappedTables | 43 | 位置を指定した表の途中で改ページしない |
wdExactOnTop | 28 | 行間が固定値の行を中央揃えにしない |
wdExpandShiftReturn | 14 | 改行記号を挿入した場合、両端揃えにしない |
wdDontSnapTextToGridInTableWithObjects | 44 | 行内にオブジェクトがある場合は文字列を表のグリッド線 (格子) に合わせない |
wdDontUseAsianBreakRulesInGrid | 48 | 文字グリッド使用時は禁則処理を行わない |
wdDontUseIndentAsNumberingTabStop | 52 | 箇条書きと段落番号のタブ位置としてぶら下げインデントを使用しない |
wdDontUseHTMLParagraphAutoSpacing | 35 | HTML の段落にはスペースの自動調整を使用しない |
wdHangulWidthLikeWW11 | 59 | 韓国語文字に比例幅を使用しない |
wdDontVertAlignInTextbox | 63 | テキスト ボックス内では縦方向に揃えない |
wdDontVertAlignCellWithShape | 61 | 図形を含む表のセルを垂直方向に揃えない |
wdDontULTrailSpace | 15 | 行末のスペースには下線を引く |
wdSpacingInWholePoints | 18 | 文字間隔の拡大/縮小を整数ポイント単位で行う |
wdForgetLastTabAlignment | 37 | 以前のタブの配置を無視する |
wdShapeLayoutLikeWW8 | 33 | Word 97/98 と同様にオートシェイプを配置する |
wdFootnoteLayoutLikeWW8 | 34 | Word 6.x/95/97/98 と同様に脚注を配置する |
wdLayoutRawTableWidth | 40 | 表を元の幅で配置する |
wdPrintBodyTextBeforeHeader | 19 | ヘッダー/フッターの前に本文を印刷する |
wdPrintColBlack | 3 | モノクロ プリンタで印刷するとき、色を黒で印刷する |
wdSelectFieldWithFirstOrLastCharacter | 45 | 最初または最後の文字を含むフィールドを選択する |
wdShowBreaksInFrames | 11 | レイアウト枠内の任意指定のページ区切り、段区切りを表示する |
wdSplitPgBreakAndParaMark | 60 | ページ区切りと段落記号を分割する |
wdSubFontBySize | 25 | フォント サイズを基準にフォントの代替を行う |
wdSuppressBottomSpacing | 29 | ページの下の余分なスペースを削除する |
wdSuppressTopSpacing | 8 | 各ページの先頭行の行間を強制的に 1 行にする |
wdSuppressTopSpacingMac5 | 17 | ページの先頭の余分なスペースを削除する (Word 5.x for the Macintosh) |
wdNoExtraLineSpacing | 23 | 余分な行間のスペースを削除する (WordPerfect 5.x) |
wdSuppressSpBfAfterPgBrk | 7 | 任意設定のページ区切りまたは段区切りの後にスペースを挿入しない |
wdSwapBordersFacingPages | 12 | 奇数ページで左右の罫線を入れ替える |
wdConvMailMergeEsc | 6 | 差し込み印刷のデータ文書で、\" を "" として扱う |
wdTruncateFontHeight | 24 | フォントの高さを切りつめる |
wdUnderlineTabInNumList | 58 | 段落番号の箇条書きでタブ文字に下線を引く |
wdCachedColBalance | 65 | キャッシュされた段落情報を使用して段を均等にする |
wdMWSmallCaps | 22 | 大きめの小型英大文字を使用する (Word 5.x for the Macintosh) |
wdApplyBreakingRules | 46 | 改行ルールを使用する |
wdUseNormalStyleForList | 51 | 箇条書きや段落番号に標準スタイルを使用する |
wdUsePrinterMetrics | 26 | 文書をレイアウトするときにプリンタの設定に従う |
wdUseWord2002TableStyleRules | 49 | Word 2002 表スタイルのルールを使用する |
wdFELineBreak11 | 53 | Word 2003 の句読点のぶら下げルールを使用する |
wdWW11IndentRules | 55 | 折り返しが設定されたオブジェクトの隣の文字列に、Word 2003 と同じインデント規則を適用する |
wdWord11KerningPairs | 64 | Word 2003 のカーニング ペアのルールを使用する |
wdAutofitLikeWW11 | 57 | Word 2003 の表の自動調整ルールを使用する |
wdWW6BorderRules | 27 | 罫線の書式を Word 6.x/95 に合わせる |
wdUseWord97LineBreakingRules | 42 | 日本語の文字列に Word 97 と同じ改行規則を適用する |
wdLineWrapLikeWord6 | 32 | 右インデントで折り返す位置を Word 6.0 に合わせる |
wdWrapTrailSpaces | 4 | 行末のスペースを次の行に送る |
wdTransparentMetafiles | 48 | メタファイルの背後にある文字列やグラフィックスを表示します。 |
wdWPSpaceWidth | 65 | スペースの幅を WordPerfect 5.x に合わせます。 |
上記表をもとに、アプリケーションに合わせてレイアウト設定できるようにしたのが下記プロシージャです。
Sub SetCompatibilityOption(lApp As Long)
'レイアウトオプション項目の設定
Select Case lApp
'Microsoft Office Word 2007
Case 1
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdDontAdjustLineHeightInTable) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontULTrailSpace) = True
End With
'Microsoft Word 2002
Case 2
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdDontAdjustLineHeightInTable) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdDontULTrailSpace) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
End With
'Microsoft Word 2000
Case 3
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdDontAdjustLineHeightInTable) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdDontULTrailSpace) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
End With
'Microsoft Word (日本語版) 97/98
Case 4
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdDontULTrailSpace) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
'Microsoft Word 97/98
Case 5
With ActiveDocument
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
'Microsoft Word (日本語版) 6.0/95
Case 6
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdAutospaceLikeWW7) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdDontULTrailSpace) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUsePrinterMetrics) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdWW6BorderRules) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
'Microsoft Word 6.0/95
Case 7
With ActiveDocument
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdAutospaceLikeWW7) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUsePrinterMetrics) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdWW6BorderRules) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
'Word for Windows 2.0
Case 8
With ActiveDocument
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdNoSpaceRaiseLower) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdPrintColBlack) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdShowBreaksInFrames) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdSuppressSpBfAfterPgBrk) = True
.Compatibility(wdSwapBordersFacingPages) = True
.Compatibility(wdConvMailMergeEsc) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUsePrinterMetrics) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
'Word for the Macintosh 5.x
Case 9
With ActiveDocument
.Compatibility(wdOrigWordTableRules) = True
.Compatibility(wdNoLeading) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdSpacingInWholePoints) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShowBreaksInFrames) = True
.Compatibility(wdSuppressTopSpacing) = True
.Compatibility(wdSuppressTopSpacingMac5) = True
.Compatibility(wdMWSmallCaps) = True
End With
'MS-DOS ワード プロセッサ
Case 10
With ActiveDocument
.Compatibility(wdNoSpaceForUL) = True
.Compatibility(wdDontAdjustLineHeightInTable) = True
.Compatibility(wdAlignTablesRowByRow) = True
.Compatibility(wdAllowSpaceOfSameStyleInTable) = True
.Compatibility(wdLayoutTableRowsApart) = True
.Compatibility(wdGrowAutofit) = True
.Compatibility(wdDontBalanceSingleByteDoubleByteWidth) = True
.Compatibility(wdLeaveBackslashAlone) = True
.Compatibility(wdNoTabHangIndent) = True
.Compatibility(wdNoSpaceRaiseLower) = True
.Compatibility(wdDontWrapTextWithPunctuation) = True
.Compatibility(wdDontAutofitConstrainedTables) = True
.Compatibility(wdDontBreakConstrainedForcedTables) = True
.Compatibility(wdDontBreakWrappedTables) = True
.Compatibility(wdExpandShiftReturn) = True
.Compatibility(wdDontSnapTextToGridInTableWithObjects) = True
.Compatibility(wdDontUseAsianBreakRulesInGrid) = True
.Compatibility(wdDontUseIndentAsNumberingTabStop) = True
.Compatibility(wdDontUseHTMLParagraphAutoSpacing) = True
.Compatibility(wdHangulWidthLikeWW11) = True
.Compatibility(wdDontVertAlignInTextbox) = True
.Compatibility(wdDontVertAlignCellWithShape) = True
.Compatibility(wdDontULTrailSpace) = True
.Compatibility(wdForgetLastTabAlignment) = True
.Compatibility(wdShapeLayoutLikeWW8) = True
.Compatibility(wdFootnoteLayoutLikeWW8) = True
.Compatibility(wdLayoutRawTableWidth) = True
.Compatibility(wdSelectFieldWithFirstOrLastCharacter) = True
.Compatibility(wdShowBreaksInFrames) = True
.Compatibility(wdSplitPgBreakAndParaMark) = True
.Compatibility(wdSuppressSpBfAfterPgBrk) = True
.Compatibility(wdUnderlineTabInNumList) = True
.Compatibility(wdCachedColBalance) = True
.Compatibility(wdUseNormalStyleForList) = True
.Compatibility(wdUseWord2002TableStyleRules) = True
.Compatibility(wdFELineBreak11) = True
.Compatibility(wdWW11IndentRules) = True
.Compatibility(wdWord11KerningPairs) = True
.Compatibility(wdAutofitLikeWW11) = True
.Compatibility(wdUseWord97LineBreakingRules) = True
End With
Case Else
MsgBox "引数を確認してください。", vbCritical
End Select
End Sub
Sub ClearCompatibilityOption()
'すべてのレイアウトオプション項目のチェックを外す
Dim i As Long
For i = 1 To 65
ActiveDocument.Compatibility(i) = False
Next
End Sub
上記プロシージャは下記コードのように、アプリケーションに応じた数値を引数にして呼び出すことで処理することができます。
Sub TestProc()
Call ClearCompatibilityOption '一度すべてクリア
Call SetCompatibilityOption(3) 'Microsoft Word 2000 に設定
MsgBox "処理が終了しました。", vbInformation
End Sub