Unable to Run script

ian0886

New Member
Joined
Dec 10, 2016
Messages
42
Hi Guys,
I need some help with my script below. I have no issues with part one of the script until when it starts going to the 2nd URL. I'll like the following to be done:

1. I'll like the "Live1" option to be selected.
2. The text to be copied and inserted from excel
3. From the masterIB select option value 1 and it mus be able to allow the server to connect, to load, before we can head to 4.
4. to paste the selection in from the server

Somehow the 2nd part of the script starts having error, i'm using IE 11 currently and excel 2013

<select name="serverName" tabindex="-1" id="serverName" style="display: none;"> <option value="-1">-Select Server-</option><option value="Live">Live</option><option value="Live1">Live1</option><option value="Live2">Live2</option><option value="Live3">Live3</option> </select>

Code:
<select name="serverName" tabindex="-1" id="serverName" style="display: none;">
			<option value="-1">-Select Server-</option><option value="Live">Live</option><option value="Live1">Live1</option><option value="Live2">Live2</option><option value="Live3">Live3</option>		</select>


<input name="profilename" class="inputtext" id="profilename" type="text">

<select name="masterIB" tabindex="-1" id="masterIB" style="display: none;">
		<option value="-1">-Select master IB-</option>
		<option value="1">HSecurities</option><option value="107">HLondon</option><option value="51">HAD</option>		</select>


<select name="childIB" tabindex="-1" id="childIB" style="display: none;" onchange="getSameLevelIB()">
		<option value="-1">-Select child IB-</option>
		</select>

<select name="masterIB" tabindex="-1" id="masterIB" style="display: none;"> <option value="-1">-Select master IB-</option> <option value="1">ADSSecurities</option><option value="107">ADS London</option><option value="51">ADS.AD</option> </select>

<select name="childIB" tabindex="-1" id="childIB" style="display: none;" onchange="getSameLevelIB()"> <option value="-1">-Select child IB-</option> </select>



Code:
 Private Sub insert1()    Set ie = CreateObject("InternetExplorer.Application")
    my_url1 = "https://abc.com/admin/createib.php"
    my_url2 = "https://abc.com/admin/createprofile.php"
    
    With ie
        .Visible = True
        .Navigate my_url1
        
    Do Until Not ie.Busy And ie.readyState = 4: DoEvents: Loop
    
    End With
    
    If InStr(ie.LocationURL, "login") > 0 Then
    'Input the userid and password
    ie.document.getElementById("login").Value = Sheets("PW").Range("B8")
    ie.document.getElementById("password").Value = Sheets("PW").Range("C8")
    ie.document.getElementById("login-btn").Click
    Application.Wait (Now + TimeValue("0.00:03"))
    ie.Navigate my_url1
    Application.Wait (Now + TimeValue("0.00:03"))
    End If
    
    With ie.document
        .getElementById("username").Value = Sheets("IB Profile").Range("B8")
        .getElementById("password").Value = Sheets("IB Profile").Range("B11")
        .getElementById("name").Value = Sheets("IB Profile").Range("B7")
        .getElementById("lname").Value = " "
        .getElementById("email").Value = Sheets("IB Profile").Range("B10")
        .getElementById("ibcode").Value = Sheets("IB Profile").Range("B9")
        .getElementById("region").Value = "Asia"
        .getElementById("country").Value = Sheets("IB Profile").Range("C6")
        .getElementById("currency").Value = "USD"
        .getElementById("balance").Value = "0"
        .getElementById("IB").Value = Sheets("IB Profile").Range("d6")
        .getElementById("submitchanges").Click
    End With


    ie.Navigate my_url2, CLng(2048)


    Application.Wait (Now + TimeValue("0.00:05"))
    
'Error starts from here
    With ie.document
        .getElementById("serverName").Value = "Live1"
        .getElementById("profilename").Value = Sheets("IB Profile").Range("B8")
        .getElementById("masterIB").Value = "HSecurities"
        .getElementById("childIB").Value = "6684"
        .getElementById("create").Click
    End With
    
End Sub

Thanks guys i seriously hope this can be done.
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,212,927
Messages
6,110,703
Members
448,293
Latest member
jin kazuya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top