Printing PDF files with VBA

前端 未结 2 947
鱼传尺愫
鱼传尺愫 2020-12-21 05:41

I am new to coding with VBA. This is my unfinished code to print documents in a folder containing documents with 3 distinct headers, \"DN\" \"INV\" and \"PO\". I\'ve been se

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-21 06:12

    The VBA code from Kajkrow works well. I needed to print to specific printer, so, if someone is looking at this, I found a solution that worked for me, simple use "printto" instead of "print" as the verb of SheelExecute, and provide the name of the specific printer name in the fourth parameter just after the filename.

    Call apiShellExecute(Application.hwnd, "printto", strPathAndFilename, "my printer name", vbNullString, 0)
    

提交回复
热议问题