VBA打印到pdf pagesetup.zoom错误

时间:2018-01-18 00:20:10

标签: excel vba

如果我单步执行以下代码(F8),除了这个奇怪的消息到达.Zoom = False

之外,它是有效的
'Print PDF
            Sheets("GRAPHIQUE").Select
            Range("A1").Select
            Application.PrintCommunication = True
            ActiveSheet.PageSetup.PrintArea = "$A$1:$Q$31"
            Application.PrintCommunication = False
            With ActiveSheet.PageSetup
                .LeftHeader = "Fichier: &F"
                .CenterHeader = ""
                .RightHeader = NomClasseurPrincipal 
                .LeftFooter = "Imprimé le: &D à &T"
                .CenterFooter = ""
                .RightFooter = "page &P de &N"
                .LeftMargin = Application.InchesToPoints(0.708661417322835)
                .RightMargin = Application.InchesToPoints(0.708661417322835)
                .TopMargin = Application.InchesToPoints(0.748031496062992)
                .BottomMargin = Application.InchesToPoints(0.748031496062992)
                .HeaderMargin = Application.InchesToPoints(0.31496062992126)
                .FooterMargin = Application.InchesToPoints(0.31496062992126)
                .PrintHeadings = False
                .PrintGridlines = False
                .PrintComments = xlPrintNoComments
                .PrintQuality = 600
                .CenterHorizontally = False
                .CenterVertically = False
                .Orientation = xlLandscape
                .Draft = False
        '        .PaperSize = xlPaperLetter
                .PaperSize = xlPaperLegal
                .FirstPageNumber = xlAutomatic
                .Order = xlDownThenOver
                .BlackAndWhite = False
                .Zoom = False
                .FitToPagesWide = 1
                .FitToPagesTall = False
                .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

对此消息说好“

"The number must be between 10 and 400. Try again by entering a number in this range."

它按照我想要的方式继续工作,但是手动用(F8)。

但是,如果我只是尝试运行它(F5)我得到的只是一个错误 Application.PrintCommunication = True

我怀疑.zoom=false中存在问题,因为在msgbox中我得到.zoom=100 ....

0 个答案:

没有答案