Hi, my Webpage is not active when i run this macro, Sendkeyps UP hapens in excel, is there a way to make the web paga active, like AppActive?
I cant get AppActive to work befor the sendkeys command.
The funny thing is that the macro works IF i open VBA befor i run it..
Sub automatic_order()
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ActiveCell.Offset(0, 20).Value
IE.Visible = True
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
If ActiveCell.Offset(0, 4).Value = "Köp" Then
IE.Document.getElementsByName("validUntil")(0).Value = ActiveCell.Offset(0, 19).Value
IE.Document.getElementById("volume").Value = ActiveCell.Offset(0, 0).Value
IE.Document.getElementById("price").Value = ActiveCell.Offset(0, 1).Value
IE.Document.getElementById("price").Select
SendKeys "{UP}", True
Sleep 2000
IE.Document.getElementsByClassName("putorder buy buyBtn")(0).Click
Sleep 1000
IE.Quit
Set IE = Nothing
Else
IE.Document.getElementsByName("validUntil")(0).Value = ActiveCell.Offset(0, 19).Value
IE.Document.getElementById("volume").Value = ActiveCell.Offset(0, 0).Value
IE.Document.getElementById("price").Value = ActiveCell.Offset(0, 1).Value
IE.Document.getElementById("price").Select
SendKeys "{UP}", True
Sleep 2000
IE.Document.getElementsByClassName("noMarginRight putorder sell sellBtn")(0).Click
Sleep 1000
IE.Quit
Set IE = Nothing
End If
End Sub
I cant get AppActive to work befor the sendkeys command.
The funny thing is that the macro works IF i open VBA befor i run it..
Sub automatic_order()
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ActiveCell.Offset(0, 20).Value
IE.Visible = True
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
If ActiveCell.Offset(0, 4).Value = "Köp" Then
IE.Document.getElementsByName("validUntil")(0).Value = ActiveCell.Offset(0, 19).Value
IE.Document.getElementById("volume").Value = ActiveCell.Offset(0, 0).Value
IE.Document.getElementById("price").Value = ActiveCell.Offset(0, 1).Value
IE.Document.getElementById("price").Select
SendKeys "{UP}", True
Sleep 2000
IE.Document.getElementsByClassName("putorder buy buyBtn")(0).Click
Sleep 1000
IE.Quit
Set IE = Nothing
Else
IE.Document.getElementsByName("validUntil")(0).Value = ActiveCell.Offset(0, 19).Value
IE.Document.getElementById("volume").Value = ActiveCell.Offset(0, 0).Value
IE.Document.getElementById("price").Value = ActiveCell.Offset(0, 1).Value
IE.Document.getElementById("price").Select
SendKeys "{UP}", True
Sleep 2000
IE.Document.getElementsByClassName("noMarginRight putorder sell sellBtn")(0).Click
Sleep 1000
IE.Quit
Set IE = Nothing
End If
End Sub