Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
打印和打印时excel 2010崩溃。预览_Excel_Vba - Fatal编程技术网

打印和打印时excel 2010崩溃。预览

打印和打印时excel 2010崩溃。预览,excel,vba,Excel,Vba,将此宏用于打印预览和打印机窗口时,Excel崩溃,因此我在Google上搜索了很多内容以了解如何解决此问题,但我失败了。以下是我用于打印预览的代码 Sub Print_TimeSht() Application.ScreenUpdating = False With ActiveSheet.PageSetup .PrintArea = "$A$1:$Q$599" ' set print area .PrintHeadings = False

将此宏用于打印预览和打印机窗口时,Excel崩溃,因此我在Google上搜索了很多内容以了解如何解决此问题,但我失败了。以下是我用于打印预览的代码

Sub Print_TimeSht()
Application.ScreenUpdating = False

  With ActiveSheet.PageSetup
  .PrintArea = "$A$1:$Q$599"           ' set print area
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments

        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlPortrait
        .Draft = False
       '.PaperSize = xlPaperA4
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = True
        .Zoom = False
        .PrintErrors = xlPrintErrorsDisplayed

     End With
         Application.ScreenUpdating = True
        With ActiveWindow
         .Zoom = 80
         .SelectedSheets.PrintPreview

        End With
Application.Dialogs(xlDialogPrint).Show
Application.ScreenUpdating = True
End Sub

因此,如何解决这些问题我使用Excel 2010 32位与Win7 32位>>?

首先,尝试将以下行更改为“true”

Application.ScreenUpdating = False
这可能会产生一条错误消息,用于您的谷歌搜索问题解决

除此之外,请检查以下项目:

1) 宏安全性设置为低(要测试此设置,请在测试后更改回原始设置) 2) 转到控制面板,选择卸载程序,单击一次Microsoft office,然后选择更改,然后修复,让程序自行检查是否缺少.dll文件等。问题可能只是缺少.dll文件 3) 如果这不能解决问题,请返回控制面板/卸载/更改,这次选择添加/删除功能
a) 确保安装了所有excel(没有任何内容显示为灰色)
b) 确保在office共享功能中安装了visual basic for applications。此外,在“共享功能”部分中,还安装了校对工具。我会保留所有excel和office共享功能,以确保覆盖所有基本功能。

回答有点晚,但对于有相同问题的人来说,最好有一个解决方案。 有时您可能未连接到打印机,以防止Excel冻结使用:

Application.PrintCommunication = False 'above:
    With Activesheet.PageSetup
及以下

End With
Application.PrintCommunication = True

这对我来说很好。。。尝试并重新安装打印机驱动程序。我尝试在另一台电脑上运行它,但同一个问题以及我在其上尝试的电脑没有连接打印机,那么问题是什么???您必须先安装打印机。如果没有物理打印机,请尝试安装pdf打印机,然后重试。