excel 2010在打印和print.preview时崩溃

时间:2012-09-08 13:12:28

标签: excel excel-vba vba

Excel崩溃当使用此宏进行打印预览和打印机窗口时,我在Google上搜索了很多,看看如何解决这个问题,但我失败了。这是我用于PrintPreview的代码< / p>

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位&gt;&gt; ??????

2 个答案:

答案 0 :(得分:0)

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

Application.ScreenUpdating = False

这可能会产生错误消息,以便在解决谷歌搜索问题时使用。

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

1)macrosecurity设置为低(测试时,测试后更改回原始设置) 2)转到控制面板,选择卸载程序,在 Microsoft Office 上单击一次,然后选择更改,然后选择修复并让程序检查自己是否缺少.dll文件等。问题可能只是缺少.dll 3)如果这不能解决问题,请返回控制面板/卸载/更改,这次选择添加/删除功能
    a)确保安装了所有excel(没有灰色)     b)确保在 office共享功能中安装应用程序的Visual Basic 。此外,在共享功能部分中,还安装了校对工具。我保留所有excel和所有办公室共享功能,以确保所有基础都被覆盖。

答案 1 :(得分:0)

答案有点晚,但对于遇到同样问题的人来说,找到解决方案是件好事。 有时您可能没有连接到打印机,以防止Excel冻结使用:

Application.PrintCommunication = False 'above:
    With Activesheet.PageSetup

及以下

End With
Application.PrintCommunication = True