i made a small vba code to get data from one of our intranet file
the code went through properly, however after the last step, i get an option to Open or Save the file.(I think i can use SendKeys, not sure about the code)
the second issue here : when I manually click on open button, i get a message
Is there any way, I can ask VBA to ignore it and open the file instead.
Also tell me of SendKey would be better or something else.please help with SendKeys code
the code went through properly, however after the last step, i get an option to Open or Save the file.(I think i can use SendKeys, not sure about the code)
the second issue here : when I manually click on open button, i get a message
The file you are trying to open abc.xls. is in a different format specified by the file extension, verify that the file is not corrupted.....
Is there any way, I can ask VBA to ignore it and open the file instead.
Also tell me of SendKey would be better or something else.please help with SendKeys code
Code:
Sub test()
Dim ie As New SHDocVw.InternetExplorer
Dim htmldoc As MSHTML.HTMLDocument
Dim htmlin As MSHTML.IHTMLElement
ie.Visible = True
ie.navigate "https://example.com"
Do While ie.readyState <> READYSTATE_COMPLETE
Loop
Set htmldoc = ie.document
Set htmlin = htmldoc.getElementById("FromDate")
htmlin.Value = Range("A1")
Set htmlin = htmldoc.getElementById("ToDate")
htmlin.Click
htmlin.Value = Range("A2")
Set htmlin = htmldoc.getElementById("Refreshdata")
htmlin.Click
Do While ie.readyState <> READYSTATE_COMPLETE
Loop
Set htmlin = htmldoc.getElementById("Download_Raw")
htmlin.Click
End Sub