dポイントプレゼントキャンペーン実施中!

こんにちは いつもお世話になっています

ワード2010でマクロ記録しました。
ページサイズをA4→B5
余白を「狭い」
フォントサイズを12P

以下の内容で失敗しています
CharsLine = 35
でひっかかりました。他にもあるかもしれません。
上記の内容だけをマクロにしたいのですがプログラムが長いようなので、簡単なマクロを教えて下さい。



Sub Macro1()
'
' Macro1 Macro
'
'
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = MillimetersToPoints(35)
.BottomMargin = MillimetersToPoints(30)
.LeftMargin = MillimetersToPoints(30)
.RightMargin = MillimetersToPoints(30)
.Gutter = MillimetersToPoints(0)
.HeaderDistance = MillimetersToPoints(15)
.FooterDistance = MillimetersToPoints(17.5)
.PageWidth = MillimetersToPoints(182)
.PageHeight = MillimetersToPoints(257)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
.CharsLine = 35
.LinesPage = 36
.LayoutMode = wdLayoutModeLineGrid
End With
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = MillimetersToPoints(12.7)
.BottomMargin = MillimetersToPoints(12.7)
.LeftMargin = MillimetersToPoints(12.7)
.RightMargin = MillimetersToPoints(12.7)
.Gutter = MillimetersToPoints(0)
.HeaderDistance = MillimetersToPoints(15)
.FooterDistance = MillimetersToPoints(17.5)
.PageWidth = MillimetersToPoints(182)
.PageHeight = MillimetersToPoints(257)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
.CharsLine = 28
.LinesPage = 30
.LayoutMode = wdLayoutModeLineGrid
End With
Selection.WholeStory
Selection.Font.Size = 12
End Sub

A 回答 (1件)

必要なネタは、ページサイズ(縦横)と余白(上下左右)、あと念のためヘッダフッタの高さですね。


フォントの設定は最後の部分で出来てるようです。

sub macro1()
 with selection.pagesetup

 .TopMargin = MillimetersToPoints(12.7)
 .BottomMargin = MillimetersToPoints(12.7)
 .LeftMargin = MillimetersToPoints(12.7)
 .RightMargin = MillimetersToPoints(12.7)
 .Gutter = MillimetersToPoints(0)
 .HeaderDistance = MillimetersToPoints(15)
 .FooterDistance = MillimetersToPoints(17.5)
 .PageWidth = MillimetersToPoints(182)
 .PageHeight = MillimetersToPoints(257)

 end with

 Selection.WholeStory
 Selection.Font.Size = 12
end sub


#エクセルじゃなくワードのご質問ですね。
    • good
    • 0
この回答へのお礼

keithin 様 ありがとうございました。お蔭様で解決しました。
すみません、タイトル間違えました。
大切に使わせていただきます。
簡単で恐縮ですが、お礼申し上げます。

お礼日時:2013/12/06 10:28

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!