I'll preface this by saying I'm a total VBA newbie and am fully aware that I'm way in over my head with this, but I'm determined to learn how to do it and finish what I started...
Ultimately, I'm trying to access a table, exportable to excel, in a private database at my company (I want to automate this process). I've managed to launch Internet explorer, utilize a userform to enter username and password, login, navigate to the correct report, but I need the program to select certain categories to generate the report on... In this case they are marketing campaigns and the report is showing the leads generated by those campaigns. Here is my VBA code thus far:
My problem now is selecting values in a table. HTML?CSS?Java? script is as follows:
Within the option value tags are the campaign names.
Bottom line question is... Is there a way to select multiple option values within that table? And if so, is there a way to utilize another userform so that my boss can select the campaigns he's interested in beforehand and the macro just selects and spits out the information after that?
Thanks in advance!
Ultimately, I'm trying to access a table, exportable to excel, in a private database at my company (I want to automate this process). I've managed to launch Internet explorer, utilize a userform to enter username and password, login, navigate to the correct report, but I need the program to select certain categories to generate the report on... In this case they are marketing campaigns and the report is showing the leads generated by those campaigns. Here is my VBA code thus far:
Option Explicit
Sub Conversion()
Dim IE As Object
Dim URL As String
Dim userName As String
Dim password As String
URL = "https://lm.leads360.com"
' Load userform - velocifyLogin
velocifyLogin.Show
' Define variables for login
userName = velocifyLogin.userNameText.Value
password = velocifyLogin.passwordText.Value
' Variables stored. Remove userform
Unload velocifyLogin
' Open Internet Explorer browser
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate URL
' Wait sequence while IE loads...
Do
DoEvents
Loop Until IE.ReadyState = 4
'
'
' Insert Login & Password --> Submit --> Go to Custom Reports
With IE
.document.getelementbyID("usernameTextBox").Value = userName
.document.getelementbyID("passwordTextBox").Value = password
.document.getelementbyID("loginButton").Click
.navigate "https://lm.leads360.com/Web/ReportsCustom.aspx"
End With
'
' Wait sequence while IE loads...
Do
DoEvents
Loop Until IE.ReadyState = 4
'
' Find Conversion Report
With IE
.document.getelementbyID("cph_searchTextBox").Value = "Ian_Automate"
.document.getelementbyID("cph_searchButton").Click
Application.Wait (Now + TimeValue("0:00:02"))
.document.getelementbyID("cph_reportRepeater_runLinkButton_0").Click
End With
End Sub
My problem now is selecting values in a table. HTML?CSS?Java? script is as follows:
I took out the html tags bc I couldn't figure out how to not have it convert into a table.table class="datatable"
thead … /thead
tbody
tr class="nohover"
td … /tdtd … /td
td id="cph_filterRepeater_valueCell_0"b /b
select id="cph_filterRepeater_bvc_0" class="idtitlepairlist" multiple="multiple" name="ctl00$cph$filterRepeater$ctl00$bvc" size="4"
option value="132" … /option
option value="28" … /option
option value="89" … /option
etc
etc
etc
Within the option value tags are the campaign names.
Bottom line question is... Is there a way to select multiple option values within that table? And if so, is there a way to utilize another userform so that my boss can select the campaigns he's interested in beforehand and the macro just selects and spits out the information after that?
Thanks in advance!
Last edited: