[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]
『printcommunication=trueで実行時エラー1004の対処方法』(gencyan)
pagesetupの処理終了後にprintcommunication=trueを実行したところ
実行時エラーの1004になったのですが対処方法がわかりません原因を教えて
ください。設定内容は下記にコピーします。よろしくお願いします。
Application.PrintCommunication = False With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.236220472440945) .RightMargin = Application.InchesToPoints(0.236220472440945) .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 = xlPrintSheetEnd .PrintQuality = 600 .CenterHorizontally = True .CenterVertically = True .Orientation = xlPortrate .Draft = False .PaperSize = xlPaperA4 .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 .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
< 使用 Excel:Excel2010、使用 OS:Windows7 >
解決方法じゃなくて申し訳ないのですが・・・
過去に同じ現象に遭遇したことがあります。 「ページ設定をコピペ」みたいなことをやろうとして。
PrintCommunication切らなければエラーは発生しないんですよね。 肝心のPageSetupの部分は何も変えてないのに。
私の場合、 このマクロがサクッと走る様にする目的でPrintCommunication切っただけだったので、 PrintCommunication切るのは止めました。
余談ですが、 自分のPCで作成したファイルを別PCで開くと 印刷とは全く関係のないマクロが何故か正常に動かなかったことがあって、 それがその別PCだけで発生する症状で、他のPCだと問題ない。
原因が分からず諦めかけてたところに、 たまたまその別PCのプリンタドライバを入れ替えることになり、 それを境に症状が直った。
なんて事もありました。
なので、 印刷に直接関係しない場面でもExcelさんはプリンタドライバから いろいろ影響を受けているんだろな・・・ と思って、 何となくPrintCommunicationは切らない様にしています。
(白茶) 2018/02/09(金) 18:00
[ 一覧(最新更新順) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.