Hi there!
I was wondering if somebody could help me with the following:
For my work, i've been creating a receipt system for incomming orders in Excel. When we get an order online, we receive it in a online web environment (Google Chrome). From there, we can print the page for our own administration in Google Chrome. But what we want, is that Excel takes the data and puts it in the right tables and cells, so that we can print our own receipts, instead of printing the whole page with a lot of unnecessary information, or even information that we don't want the customer to see.
So how do I do this? We can't edit the website because it's controlled by a different company. I've tried it with 'getElementsByClassName', but with no succes. Also, the text i'm trying to get, is not in a seperate class. The whole page counts as the only class in the page. I've heard about the option "Find" and "FindNext", but I don't know how to use them. What helps, is that everything they ordered always starts with a '#'. I need to get the value after that and put it in the right cell in my sheet.
Here's what I got so far:
Private Sub CommandButton7_Click()
Dim IE As Object
Dim data As String
data = WebBrowser1.LocationURL
' Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
' URL to get data from
IE.Navigate data
' Statusbar
Application.StatusBar = "Loading, Please wait..."
' Wait while IE loading...
Do While IE.busy
Application.Wait DateAdd("s", 1, Now)
Loop
Application.StatusBar = "Searching for value. Please wait..."
Dim dd As String
dd = IE.Document.getElementsByClassName("bestelling bes3")(0).innerText
MsgBox dd
' Show IE
IE.Visible = True
' Clean up
Set IE = Nothing
Application.StatusBar = ""
End Sub
This gives me an error.
Who can help me? Please keep in mind that I have almost no VBA experience, but I do have programming experience. I used to program games in C# and JavaScript. So this is kinda new to me.
Arnout
Bookmarks