Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use VBScript in IE to print directly without prompting

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use VBScript in IE to print directly without prompting. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

First, add the Object of WebBrowser to the HTML page:

After that, print with the following code:

Sub printvb ()

Wb.execwb 6,2,3

End Sub

The key code wb.execwb 6jing2jing3 can actually print directly without prompting in VBScript mode, but it is strange that with the same parameters, IE will still pop up a print conversation window in Javascript mode, perhaps because VBScript is developed by Microsoft specifically for IE, while Javascript is an outsider after all:)

Another more comprehensive example can be found as follows:

6=OLECMDID_PRINT

2=OLECMDEXECOPT_DONTPROMPTUSER

2+1=PRINT_WAITFORCOMPLETION + PRINT_DONTBOTHERUSER

WB.ExecWB 6, 2, 3, 0

Sub window_onunload

On Error Resume Next

Set WB = nothing

End Sub

Sub vbPrintPage (x, y, z)

OLECMDID_PRINT = 6

OLECMDEXECOPT_DODEFAULT = 0

OLECMDEXECOPT_PROMPTUSER = 1

OLECMDEXECOPT_DONTPROMPTUSER = 2

On Error Resume Next

WB.ExecWB x, y, z, 0

End Sub

Print Test

This is the end of this article on "how to print directly without prompting in VBScript in IE". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report