Just for FUN Easy Login with Macro

nbob

Board Regular
Joined
Nov 9, 2011
Messages
52
When i get to work I need to login to about five different programs! sometimes taking an exorbitant amount of time, sometimes as much as ten minutes! I want to be able to click one shortcut on my desktop and open and login to most of my programs. I have done this with most of the programs I use with your typical code for finding a cell and entering the PW and UN:

Code:
Set UserN = appIE1.Document.GetElementsByName("txtTheAgent")
If Not UserN Is Nothing Then
    UserN(0).Value = "7158"
End If

Set PW = appIE1.Document.GetElementsByName("txtTheInitials") ' password
If Not PW Is Nothing Then
    PW(0).Value = "nb"
End If
My problem is that this code does not work on .jsp window for one of our main programs. There is a floating window that pops up and I can get to pop up with the cursor in the username field. However there is no right click ability to view source code?? Any way to just send text to this field as it is the field with my cursor flashing? How can I direct the macro to find this specific window if needed? Here is the URL that I need to enter text into UN and PW fields

"https://www.dmcseddebt.com/CRSServicesWeb/jsp/launch.jsp"

thanks!;)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
If the cursor is on that field and its the active window you could try using sendkeys, eg:
Code:
sendkeys ("user1")
sendkeys {TAB}
sendkeys ("Password1")

sendkeys is very particular and may not always work, give it a try though :)
 
Upvote 0
Great thanks!

Ill try that in the am. I thought i possibly tried that. I will lead it with an application.wait so I know that the java login window is fully loaded.
 
Upvote 0
I am still having an issue with this I am getting an error this is the end of my macro...

Code:
sURL2 = "[URL]https://www.dmcseddebt.com/CRSServicesWeb/jsp/launch.jsp[/URL]"
With appIE2
 .navigate sURL2
.Visible = True
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
End With
With appIE2
    Application.Sendkey ("myun")
    Application.Sendkey [Tab]
    Application.Sendkey ("mypw")
End With

error states: runtime error 438 Object does not support this property or method...
 
Upvote 0
the problem is below
Code:
With appIE2
    Application.Sendkey ("myun")
    Application.Sendkey [Tab]
    Application.Sendkey ("mypw")
End With

just remove the with's as sendkeys is an application method not IE so:

Code:
sURL2 = "[URL="https://www.dmcseddebt.com/CRSServicesWeb/jsp/launch.jsp"][COLOR=#304c6c]https://www.dmcseddebt.com/CRSServic...jsp/launch.jsp[/COLOR][/URL]"
With appIE2
 .navigate sURL2
.Visible = True
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
End With
Application.Sendkey ("myun")
Application.Sendkey [Tab]
Application.Sendkey ("mypw")
 
Upvote 0
I see what you say about particular. I am getting one sometimes two letters to go into the frst field. I tried both the full username in the (" ") and then I also tried separating each character into its own application.sendkeys (" "). the most I could get to insert was the first two characters into the username fields. It then would go to tab and does not recognize tab i get an error 1004 the item with the specified name wasn't found...any other ideas on this?
 
Upvote 0
WHoo HOO! had to use this format and have a blank line between each sendkeys so...looks like this.:

application.sendkeys "m", True

application.sendkeys "y",True

application.Sendkeys "{TAB}", True

etc. etc. etc.

Thanks!
 
Upvote 0
no worries, glad you sorted it out, just a note of warning, ensure that that login screen is the last one loaded and nothing changes afterward. reason being is that send keys sends them to the active screen so if something is taking the focus away then it will fail :)

other than that its a fun tool :)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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