在Mac上打开“打印"对话框 [英] Open Print Dialog on Mac
问题描述
下面的VBA代码在Windows上打开打印对话框,但在Mac Excel 2011上不起作用,在Application.Dialogs(xlDialogPrinterSetup).Show
The VBA code below opens the print dialog on Windows but is not working on Mac Excel 2011, giving a runtime error 1004 on the line Application.Dialogs(xlDialogPrinterSetup).Show
Private Sub cbPrint_Click()
Dim Caption As String
If formPrintOptions.Frame1.ActiveControl.Value Then
Caption = formPrintOptions.Frame1.ActiveControl.Caption
formPrintOptions.Hide
Application.Dialogs(xlDialogPrinterSetup).Show
Select Case Caption
Case "Id1"
ThisWorkbook.Sheets(Array("FrontPage", "Id1")).PrintOut Preview:=True
Case "Id2"
ThisWorkbook.Sheets(Array("FrontPage", "Id2")).PrintOut Preview:=True
Case "Id3"
ThisWorkbook.Sheets(Array("FrontPage", "Id3")).PrintOut Preview:=True
Case "Id4"
ThisWorkbook.Sheets(Array("FrontPage", "Id4")).PrintOut Preview:=True
Case Else
End Select
Else
MsgBox "None selected"
End If
Unload formPrintOptions
End Sub
请问有人可以在Mac Excel 2011上打开打印对话框窗口吗?
Please can someone advise if there is a way to open the print dialog window on Mac Excel 2011?
推荐答案
来自此处有三个选项:
(报价)
在这种情况下,该功能位于Mac正常打印屏幕的顶部". 在不需要调用下级对话框的意义上,顶部"都位于打印对话框"上所有其他选项的上方.
In that case, that functionality is "on the top" of the normal Print screen for Mac. "On top" both in the sense that no subordinate dialog needs to be invoked and it is above all the other options on the Print Dialog box.
或
Application.Dialogs(xlDialogPrint).Show
或
MsgBox MacScript(PrintSetupMacScript())
Function PrintSetupMacScript() As String
PrintSetupMacScript = "try"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "tell application ""System Preferences"" "
PrintSetupMacScript = PrintSetupMacScript & vbLf & " reveal pane ""Print & Fax"" "
PrintSetupMacScript = PrintSetupMacScript & vbLf & " activate"
PrintSetupMacScript = PrintSetupMacScript & vbLf & " repeat while (name of window 1) = ""Print & Fax"" "
PrintSetupMacScript = PrintSetupMacScript & vbLf & " end repeat"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "end tell"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "return true"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "on error"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "return false"
PrintSetupMacScript = PrintSetupMacScript & vbLf & "end try"
End Function
没有Mac来进行测试,我无法保证其续航里程
not having a mac to test these on, I can't vouch for their mileage
这篇关于在Mac上打开“打印"对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!