Quote:
|
Originally Posted by namliam
I am unable to help you but would like verry much to see your FULL code which you are using to extract info from an HTML page...
TIA
|
Here it is. I am assume the webpage is open to start but you can use a SHELL function to open your browser via command line.
Code:
Sub transferMarketView()
Dim tmpObj As Object
Dim CurrentBook As Object
Set CurrentBook = ActiveWorkbook
AppActivate "MarketView", False
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "{TAB}"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "{TAB}"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "{DOWN}"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 15
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "^a"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "^c"
AppActivate "Microsoft Excel - Importer", False
Application.DisplayAlerts = False
Workbooks(1).Sheets("Raw").Delete
Workbooks.Add
Set tmpObj = ActiveWorkbook
Sheets.Add After:=Sheets(1)
Sheets(2).Select
Sheets(2).Name = "Raw"
Sheets("Raw").Activate
Application.DisplayAlerts = False
ActiveSheet.Paste
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Sheets("Raw").Copy Before:=Workbooks("Importer.xls").Sheets(2)
Dim tmpName As String
tmpName = tmpObj.FullName
Windows(tmpName).Activate
ActiveWindow.Close
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
CurrentBook.Activate
Control.Activate
End Sub
Once I finish it...I will add comments and repost. The VBA help is very useful especially once you know that it can be done and what commands to lookup. The function to look at are SHELL, APPACTIVATE, and SENDKEYS. And you can use these on any 32-bit application not just a web browser.