AWS Simple Calculator Results to Excel
I am working on an analytical problem where some information from the Amazon EC2 calculator would be needed.
I have a spreadsheet that will perform some criteria analysis and for each iteration I will need specific cost of services provided by AWS.
My solution invokes, in a user form, AWS simple calculator, allowing the user to specify the type of services he will use from AWS, then by pressing a button, placed on the same user form the value of his Total Monthly payment must be parsed to a cell in the main workbook. That operation should be repeated for each of the test scenarios.
Please, some help with the VBA that will capture the value from the website and parse it to a cell within the workbook will be greatly appreciated.
Thanks,
Morph.
P.S. Here is the code I use. Unfortunately it parses only the labels and not the content of dynamic data cells.
Public r As Integer, c As Integer, t As Integer
Public elemCollection As Object
Public Sub UserForm_Initialize()
On Error Resume Next
ThisWorkbook.Sheets("Sheet3").Range("A1:Z1000").ClearContents
' Me.AWSBrowser.Navigate "http://calculator.s3.amazonaws.com/index.html"
Me.AWSBrowser.Navigate "http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-66FBFC35-AC72-4685-BCA2-1B37ABF5A59A"
Do
DoEvents
Loop Until AWSBrowser.ReadyState = READYSTATE_COMPLETE
End Sub
Public Sub bn_ImportData_Click()
On Error Resume Next
Set elemCollection = AWSBrowser.Document.getElementsByTagName("table")
For t = 0 To (elemCollection.Length - 1)
For r = 0 To (elemCollection(t).Rows.Length - 1)
For c = 0 To (elemCollection(t).Rows(r).Cells.Length - 1)
ThisWorkbook.Sheets("Sheet3").Cells(r + 1, c + 1) = elemCollection(t).Rows(r).Cells(c).innerText
Next c
Next r
Next t
Unload Me
End Sub
Recent comments
5 years 42 weeks ago
6 years 28 weeks ago
6 years 40 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 49 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago