我设法使用ExecuteExcel4Macro从工作簿中获取数据。 但是我可以在文件中打印一张纸而不打开文件吗?
答案 0 :(得分:0)
这是API版本:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_HIDE As Long = 0&
Sub PrintFile(strFilepath As String)
ShellExecute Application.hWnd, "Print", strFilepath, 0&, 0&, SW_HIDE
End Sub
您的主叫代码只使用:
Call PrintFile("C:\path to file.xls")
例如。