Print regularly to activate the printer (for some printers that need to be activated to print)

Save the following code as prtxls.vbs, and then you can use it on the command line, such as printing a.xlsx under C drive with the command prtxls.vbs c:\a.xlsx
Dim objxls
On error resume next.
Set objxls = wscript getobject (” Excel. Application “)
If objxls = “” then.
Set objxls = wscript createobject (” Excel. Application”)
end If
the If Wscript.argument.count = 0 then
msgBox (” There are not enough arguments.”)
cript.quit
e>f
objxls.>books.open wscript.arguments(0),false
if objxls.wor>ks.count = 0 then
Wscript.quit
Else
objxls.workbooks(1).printout
objxls.quit
End if
wscript.quit


So that’s the code

prtxls.vbs c:\a.xlsx
: \a.xlsx
c:\a.xlsx
Note: A. Xlsx must add content, otherwise the printer will not print the content because it is empty.

Read More: