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.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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.
 
Upvote 0
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!
 
Upvote 0
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.
 
Upvote 0
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:
 
Upvote 0
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:
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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