How to login with username and password via Microsoft Edge in VBA code

healeydm

New Member
Joined
Mar 5, 2024
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I'm still pretty green when it comes to coding in VBA. I've tried multiple different strings of code to try and accomplish this - all of them have worked in terms of getting me to my desired site in Microsoft Edge, but I haven't gotten any further. I've only ever been able to successfully write the code to login to the site when using Internet Explorer as the browser, I can't use Internet Explorer as the browser anymore as we can't use it at my place of employment. How would I go about writing the piece to enter my username, password, and then click submit? My current code is below, and I'm open to any suggestions/changes!
Code:

I'm also attaching the HTML code for their sign on process - I've had a hard time figuring out if I should be using the input type or id:
HTML:
  <div class="ps_box-control psloginerror" id="browsercheck_error" name="browsercheck_error" aria-live="assertive" role="alert"></div>
            </div>
          
           <div>
               <span class="ps_label-show" id="ptLabelUserid"><label for="userid">User ID</label></span>
           </div>
            <div class="ps_box-control">
               <input type="text" id="userid" name="userid" value="" title="User ID">
            </div>
           <div>
               <span class="ps_label-show" id="ptLabelPassword"><label for="pwd">Password</label></span>
           </div>
            <div class="ps_box-control">
               <input type="password" id="pwd" name="pwd" title="Password" >
            </div>
        <div>
                <span class="ps_label-show" id="ptLabelSelect"><label for="ptlangsel">Select a Language</label></span>
           </div>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Whoops, my VBA didn't upload correctly in my initial post:


VBA Code:
Sub OpenEdge_Successful_Code()
    Dim edgePath As String
    Dim edgeURL As String


    ' Set the path to Microsoft Edge executable file
    edgePath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
     
    ' Set the URL that you want to open in Microsoft Edge
    edgeURL = "https://thewebsiteimusing"
     
    ' Open Microsoft Edge with the specified URL
    Shell edgePath & " " & edgeURL, vbNormalFocus
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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