RodrigoFinguer
Board Regular
- Joined
- Jun 13, 2017
- Messages
- 75
Hi guys.
I am using this code for my work:
the code works fine there on my work, but in my home the code ignore the "VBA.AppActivate IE.document.Title & " - " & IE.Name, 0" and the "IE.document.getElementById("search-input-productdata").Value = Sheets("Planilha1").Cells(i, 2).Text", so, i have to pull up the arrow so he can read it. At the last line, the code gives me an error (which does not happen on my work). I have no clue, is it references problem? i don't know what to do.
I am using this code for my work:
Code:
[B]Sub Automate_IE_Load_Page()[/B]
[B]'This will load a webpage in IE[/B]
[B] Dim URL As String[/B]
[B] Dim IE As InternetExplorer[/B]
[B] Dim linhas As Single[/B]
[B] Dim j As Long: j = 0[/B]
[B] Dim Elements As Object[/B]
[B] Dim Element As Object[/B]
[B] Dim Elements2 As Object[/B]
[B] 'Create InternetExplorer Object[/B]
[B] Set IE = CreateObject("InternetExplorer.Application")[/B]
[B] 'Set IE.Visible = True to make IE visible, or False for IE to run in the background[/B]
[B] IE.Visible = True[/B]
[B] 'Define URL[/B]
[B] URL = "https://www.sew-eurodrive.de/os/dud/?tab=productdata&country=DE&language=en_US"[/B]
[B] 'Navigate to URL[/B]
[B] IE.navigate URL[/B]
[B] ' Statusbar let's user know website is loading[/B]
[B] Application.StatusBar = URL & " is loading. Please wait..."[/B]
[B] ' Wait while IE loading...[/B]
[B] Do While IE.Busy = True[/B]
[B] Application.Wait DateAdd("s", 1, Now)[/B]
[B] Loop[/B]
[B] 'Webpage Loaded[/B]
[B] Application.StatusBar = URL & " Loaded"[/B]
[B] 'Pega os valores na coluna B[/B]
[B] Windows("trabalho.xlsm").Activate[/B]
[B] linhas = WorksheetFunction.CountA(Sheets("Planilha1").Columns("B:B"))[/B]
[B] For i = 2 To linhas[/B]
[B] VBA.AppActivate IE.document.Title & " - " & IE.Name, 0[/B]
[B] IE.document.getElementById("search-input-productdata").Value = Sheets("Planilha1").Cells(i, 2).Text[/B]
[B] 'IE.document.getElementById("search-button-productdata").submit[/B]
[B] IE.document.forms(3).Item(3).Click
[/B]....... (continuous)
the code works fine there on my work, but in my home the code ignore the "VBA.AppActivate IE.document.Title & " - " & IE.Name, 0" and the "IE.document.getElementById("search-input-productdata").Value = Sheets("Planilha1").Cells(i, 2).Text", so, i have to pull up the arrow so he can read it. At the last line, the code gives me an error (which does not happen on my work). I have no clue, is it references problem? i don't know what to do.