0

我有进入 Intranet 的 Excel 代码:

sub TESTE()

Dim Data As Date
Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True

URL = "(URL address)"
ie.navigate (URL)

Data = Date - 1

ie.document.getElementById("ctl31_ctl04_ctl03_ddDropDownButton").Click ' Calendario
ie.document.getElementById("ctl31_ctl04_ctl03_txtValue").Value = Format(Data, "dd/mm/yyyy") ' Data
ie.document.getElementById("ctl31_ctl04_ctl00").Click ' Exibir Relatório

URL = "(URL address)"
ie.navigate (URL)

End Sub  

但是,在代码的最后一行中,导出不会在所选日期之前发生,它总是考虑今天。我可以做些什么来使出口考虑一个选定的日期?

4

2 回答 2

0
Sub Extrai_MIS()

Dim data As Date
Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")

URL = "(URL address)"

    Do
        DoEvents
     Loop Until ie.readystate = 4

ie.Visible = True

data = Range("A4")

If Range("Q1") < data Then
ie.Quit
MsgBox ("Não contém informações nessa data, escolha outra."), vbCritical, "ATENÇÃO:"
Exit Sub
End If

ie.document.getElementById("ctl31_ctl04_ctl03_ddDropDownButton").Click ' Calendario
ie.document.getElementById("ctl31_ctl04_ctl03_txtValue").Value = Format(data, "dd/mm/yyyy") ' Data
Application.Wait Now + TimeValue("00:00:10") ' Tempo para carregar a pagina
ie.document.getElementById("ctl31_ctl04_ctl00").Click ' Exibir Relatório
    Do
    DoEvents
    Loop Until ie.readystate = 4

    Application.Wait Now + TimeValue("00:00:10")

    For Each ele In ie.document.getelementsbytagname("a")
    If ele.classname = "ActiveLink" Then
    If ele.innertext = "Excel" Then
    ele.Click
     Exit For
          End If
        End If
    Next
ie.Visible = True
Application.Wait Now + TimeValue("00:00:10")
Application.SendKeys ("%+s")
Application.Wait Now + TimeValue("00:00:10")

ie.Quit

ChDir Environ("USERPROFILE") & "\Downloads"
    Workbooks.Open Filename:= _
        Environ("USERPROFILE") & "\Downloads\rpt_visoes_orders_today.xls"
    ThisWorkbook.Activate
End Sub
于 2013-10-03T20:03:16.730 回答
0

一些宏,触发电子邮件按照负责?例如:Fulando 负责A 类,Bentrano 负责,我想要一个宏来做这个分离并将电子邮件转发给负责的权利。

于 2013-10-03T19:51:24.273 回答