我一直遇到从命令行直接打印安全pdf到 another pdf 的问题(从vba通过Adobe调用“打印到Pdf”)并保存它:

Excel VBA, "Print" secured pdf to another pdf file using Shell

我需要这样做以规避安全的pdf,以便能够将其转换为文本 . 作为公司的PC,我只能访问Adobe和Nitro . 我一直在尝试使用Shell命令,并提出以下内容:

"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"  /t C:\Users\1402\Desktop\test2\20171207fmbnit.pdf "Microsoft Print to Pdf" >> "C:\Users\1402\Desktop\Testing\testq24.pdf" /s

间歇性地在命令中指定的文件夹中创建并保存0 kb pdf文件,并显示文件已损坏,或者执行此操作然后提示另存为窗口,从而创建正确的文件 . 要解决这个问题,有没有办法通过VBA中的 shell() 捕获此行的输出,并从那里完成"Save As"?类似的东西:

Dim oExec As Object
    Dim oOutput As Object
    Set oExec = oShell.Exec(sCmd)
    Set oOutput = oExec.StdOut

其中 oOutput 是PDF文件,命令与上述相同 .