Экспорт Crystal Report в PDF через VBA - PullRequest
1 голос
/ 15 мая 2019

Я пытаюсь запустить отчет в Internet Explorer и загрузить его в формате PDF. Я могу создать отчет, но сгенерированный отчет открывается в Crystal Viewer, о котором я не знаю.

Я бы хотел экспортировать отчет через VBA.

Я уже опубликовал тему в VBAexpress , но не получил ответа.

Sub Trail1()
    Dim ie As Object
    Dim URL As String
    Dim PropertyNames As String
    Dim TStatus As String
    Dim FrmDate As String
    Dim ToDate As String
    Dim AsOf As String
    Dim Vendor As String
    Dim LockBox As String
    Dim Parse As String
    Dim Destination As String

    PropertyNames = ThisWorkbook.Sheets(2).Range("C14").Value
    TStatus = ThisWorkbook.Sheets(2).Range("C15").Value
    FrmDate = ThisWorkbook.Sheets(2).Range("C16").Value
    ToDate = ThisWorkbook.Sheets(2).Range("C17").Value
    AsOf = ThisWorkbook.Sheets(2).Range("C18").Value
    Vendor = ThisWorkbook.Sheets(2).Range("C19").Value
    LockBox = ThisWorkbook.Sheets(2).Range("C20").Value
    Parse = ThisWorkbook.Sheets(2).Range("C21").Value
    Destination = ThisWorkbook.Sheets(2).Range("C22").Value

    Set ie = CreateObject("Internetexplorer.application")
    ie.Visible = True

    ie.navigate "https://www.yardipcu.com/22466colonysso/pages/SysSqlScript.aspx?Action=FILTER&From=SQLREPORTS&select=reports/rs_jdr_tenant_statement_cobalt.txt"
    Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop

    ie.document.getElementsByClassName("form_button")(0).Click

    ie.document.getElementsByName("phMy")(0).Value = PropertyNames
    ie.document.getElementsByName("Status")(0).Value = TStatus
    ie.document.getElementsByName("begmonth")(0).Value = Format(FrmDate, "MM/YYYY")
    ie.document.getElementsByName("endmonth")(0).Value = Format(ToDate, "MM/YYYY")
    ie.document.getElementsByName("begdate")(0).Value = Format(AsOf, "MM/DD/YYYY")
    ie.document.getElementsByName("vendor")(0).Value = Vendor
    ie.document.getElementsByName("lockbox")(0).Value = LockBox
    ie.document.getElementsByName("sParse")(0).Value = Parse
    ie.document.getElementsByName("RptOutput")(0).Value = Destination

    ie.document.getElementsByClassName("filter_submit")(0).Click

    'After this, the report will be generated in a new Crystal Report window
    'I am not even able to get the source code from Inspect Element to proceed with the export

End Sub
...