大家好:
因個人工作需要,如下VBS指令自動選擇列表機列印,但是否可增加指令固定只列印第一頁面就好了,其餘頁面不用列印!
strPrinter = "你的印表機名稱"
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
strWQL = "select * from Win32_Printer WHERE name='" & strPrinter & "'"
Set objInstances = objWMI.ExecQuery(strWQL,,48)
For Each objInstance in objInstances
intResult = objInstance.SetDefaultPrinter
If intResult=0 Then
WScript.Echo "Set Default Printer to "&strPrinter
Exit For
End If
Next