从记事本中打印多个URL

时间:2018-05-24 09:35:58

标签: excel vba

我在Excel文件中有很多网址。我正在尝试打开每个URL并以静默方式打印/将页面另存为PDF。我有以下代码。这有效,但要求打印确认(打印对话窗口)。任何人都可以在静音模式下打印,即不显示打印对话窗口。

Sub View_Tech_Recalls()
    Set ie = CreateObject("InternetExplorer.Application")

   Recall_URL = Range("A1").Value
    ie.Navigate Recall_URL
    ie.StatusBar = False
    ie.Toolbar = True
    ie.Visible = True
    ie.Resizable = True
    ie.AddressBar = False


    TimeOutWebQuery = 5
    TimeOutTime = DateAdd("s", TimeOutWebQuery, Now)
    Do Until ie.ReadyState = 4
        DoEvents
        If Now > TimeOutTime Then
            ie.stop
            GoTo ErrorTimeOut
        End If
    Loop




    Application.Wait (Now + TimeValue("0:00:03"))

    ie.ExecWB 6, 2

ErrorTimeOut:


    Set ie = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

我不确定您的要求的实施情况,但也许ExportAsFixedFormat Type:=xlTypePDF可能是您的解决方案?

然后你可以在执行前设置application.displayalerts = false,所以应该默默地进行。