Userform automation

vbsteve

Board Regular
Joined
Dec 11, 2003
Messages
99
Hi

Don't know if this would be possible or not? Its a bit complicated, what I'm doing is activating a excel workbook from another workbook then running the macro in the second workbook from the first, this then loads a userform prompting the user to enter some login details. Is there any way that i can automatically enter the login details from the first workbook?? The reason for this is the second workbook sits on our Citrix server and we cannot make any changes to it other than entering details to upload to our database.
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
On the userform_initialize sub just change the values.

Like textbox1.value = "my logon name"
textbox2.value = "my password"

or

textbox1.value = workbooks("workbook1").Sheets("Sheet1").Range("A1").Value

if the values you want are stored in the other workbook.
 

vbsteve

Board Regular
Joined
Dec 11, 2003
Messages
99
DRJ I cant make any changes to the workbook that contains the userform as this is on a server - Marked as read only. We cannot take a copy of it then save it back to the server as firstly its not just used by one person it used by several different people for several different things, secondly the server you logon to can change each time you log on (This is not a static server).

After doing some searches and spending a good couple of hours I have worked out how to automated the inputting of details on a userform from a seperate workbook! but in my case i cant use this as this again involves changing the workbook thats on the citrix server! But i havent given up hope! there must be away of being able to automate this task!!!!!!

Thanks for your suggestion DRJ. Any other suggestions would be kindly appreciated!
 

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
You can try to use send keys, but that is very unreliable. Without being able to change the workbook that has the userform I think you are out of luck.
 

vbsteve

Board Regular
Joined
Dec 11, 2003
Messages
99
Yeah i had tried using sendkeys but once the forms loaded the macro will not continue to run to sendkeys, unless im doing something wrong!

I thought as much!

Thanks for your help anyway! :cool:
 

vbsteve

Board Regular
Joined
Dec 11, 2003
Messages
99
Further to posting my reply I have used the OnTime & SendKeys Functions to enter the login information automatically.

Code:
Sub API_TEST()

Windows("API.xls").Activate
Application.OnTime Now + TimeValue("00:00:15"), "SEND_LOGIN"
Application.Run ("API!btnLoginActionFired")
End Sub

Sub SEND_LOGIN()

Application.SendKeys ("Login Name")
Application.SendKeys "{TAB}"
Application.SendKeys ("Login Password")
Application.SendKeys "{TAB}"
Application.SendKeys ("Login Connect String")

Although this can be unreliable i felt this was the best way of achieving what i set out to do.
:cool:
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,915
Members
413,952
Latest member
JGer

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
Top