使用Excel VBA,并尝试打印插图文件

时间:2015-04-16 00:41:09

标签: excel-vba adobe-illustrator vba excel

操作系统是WindowsXP,Office版本2003,插图画家使用10。

使用Excel VBA,并尝试打印插图文件。

如果运行以下代码,则会在调用aiDocRef.PrintOut时发生错误。 或者不会因为某人的原因而折叠。

错误内容如下。

  

“运行时错误”-2147212093(800424c3)'发生未知错误:   ···@“

'In the References that you check the "Windows Host Script Object Model"
'In the References "Adobe Illustrator 10.0 Type Library" be checked

Option Explicit

Sub test1 ()
    
    Dim path As String: path = "C: \ test.eps"
    Call IllustratorController.PrintOut (path)

End Sub

我想打印'指定的插图文件

Public Sub PrintOut (ByVal filePath As String)
    
    Open the 'illustrator (illustrator does not appear in front of you do not use the WSH)
    Dim wsh As New WshShell
    Call wsh.Run (filePath, 3)
    
    I open the 'illustrations
    Dim aiAppRef As New Illustrator.Application
    Dim aiDocRef As Illustrator.Document: Set aiDocRef = aiAppRef.Open (filePath)
    
    I want to print a 'document
    Call aiDocRef.PrintOut
        
End Sub

0 个答案:

没有答案