1
私はおそらく単純だと思う印刷マクロを作業してきました。私はマクロを記録しようとしましたが、他の人のコードを見て数時間研究しています。私が希望することにマクロ用です:アクティブなワークシート特定の方法でページを設定するVBA印刷マクロ
2のすべてのセルを選択し
1))1ページにすべての列に収まるように印刷倍率を設定
3)印刷風景モード
4)印刷プレビューを開く(可能な場合)
5)#4が不可能な場合は、印刷ジョブを実行します。
私の現在のコードを実行すると、Excelワークシートがたくさんのページ(チェッカーボードスタイル)に分割され、エラーコードが表示されます。読んでくれてありがとう。
これは私の現在のコードです:ここでは、その後、私は通常使用しているものだ、私はそれがあなたの質問に一致するように作られた
Sub PrintNOPAsheet()'
' PrintNOPAsheet Macro
Cells.Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$H$346"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
End Sub
「
私はその部分を残しました。また、選択したセルを印刷することも欲しかった。 – Rami
また、ありがとうございました!あなたが書いたコードは、選択されたセルを印刷する必要があるという事実以外には完璧に動作します。 – Rami
問題に対処するコードに追加されました。お役に立てれば! – calallen63