繁体   English   中英

在Internet Explorer中打开pdf文件后,应立即打开打印蒙版

[英]As soon pdf file is open in Internet Explorer, the printmask should be open

场景:

  1. 打开Internet Explorer
  2. 转到特定网页
  3. 输入一些必填信息
  4. 点击按钮信息将被传输
  5. 之后,将创建一个pdf文件,并在浏览器中显示(即新的
    标签)

现在我需要的是自动打印此pdf文件或打开打印蒙版,然后按Enter。

我希望可以使用宏来执行此操作,但是不知道如何在IE中执行该操作。 另一个想法是用C#编写服务以侦听某些事件。

有人有主意吗? 谢谢!

您可以尝试参考下面的代码示例,并开始使用VBA学习IE Automation。 这是一个很好的入门示例。 如果您遇到任何问题,请尝试一下并告知我们。

Sub Automate_IE_Load_Page()
'This will load a webpage in IE
    Dim i As Long
    Dim URL As String
    Dim IE As Object
    Dim objElement As Object
    Dim objCollection As Object

    'Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")

    'Set IE.Visible = True to make IE visible, or False for IE to run in the background
    IE.Visible = True

    'Define URL
    URL = "https://www.Microsoft.com"

    'Navigate to URL
    IE.Navigate URL

    ' Statusbar let's user know website is loading
    Application.StatusBar = URL & " is loading. Please wait..."

    ' Wait while IE loading...
    'IE ReadyState = 4 signifies the webpage has loaded (the first loop is set to avoid inadvertently skipping over the second loop)
    Do While IE.ReadyState = 4: DoEvents: Loop   'Do While
    Do Until IE.ReadyState = 4: DoEvents: Loop   'Do Until

    'Webpage Loaded
    Application.StatusBar = URL & " Loaded"

    'Unload IE
    Set IE = Nothing
    Set objElement = Nothing
    Set objCollection = Nothing

End Sub

参考:

使用VBA自动化Internet Explorer(IE)

要从IE打印,您可以在下面的链接中参考答案。

打印IE网页

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM