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

こんばんは。
EXCEL VBAでひとつのファイルの中のすべてのシートの余白とA4横サイズに統一したいのです。
マクロの記録をとると

With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.393700787401575)
.RightMargin = Application.InchesToPoints(0.393700787401575)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub
このように記述されますが、どのように加工したらよろしいでしょうか?
教えてください。

A 回答 (2件)

Sub aaa()


Dim i As Integer

For i = 1 To Worksheets.Count
  With Worksheets(i).PageSetup
   .Orientation = xlLandscape
   .LeftMargin = Application.InchesToPoints(0.393700787401575)
   .RightMargin = Application.InchesToPoints(0.393700787401575)
   .TopMargin = Application.InchesToPoints(0.393700787401575)
   .BottomMargin = Application.InchesToPoints(0.393700787401575)
  End With
Next i

End Sub


とか。
数値は適当に。
また、以下のURLも参照ください。
http://homepage1.nifty.com/tabotabo/insat/excelp …
    • good
    • 0
この回答へのお礼

できました。
ありがとうございました。

お礼日時:2009/07/04 09:58

これ忘れました。


With~End With の中に追加してください。

.PaperSize = xlPaperA4
    • good
    • 0

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