Hello Oz! This is my first post and I want to start by saying thanks! The length you guys go to help people is AMAZING. I've been using your site for some months now and I've learned so many neat things and found all kinds of great code and I am very grateful. You have saved me god knows how many hours of work already and made some of my coworkers extremely happy with the new tools I've been able to provide. THANK YOU SO MUCH!
Now for my first question;
The following script is attached to a button labelled "Audit" on a worksheet that starts by copying the cell a user has selected (containing an account#), it then calls the emulator(UV/TERM) we use to access our host system and pulls up the account for them. The script runs perfectly (yes I know, the dreaded SENDKEYS but I don't know what else to try...I couldn't find it that list of books you can add in VB editor). Currently I have hardcoded in a single User ID and a series of passwords. What I would like to do is prompt the user to enter their own credentials, then save them so the next time they press the Audit button they are not prompted to enter it again. However, when they exit the spreadsheet no record of their user ID or password should be saved. Note that I am purposely calling a new instance of the emulator each time they press the button, it would be next to impossible to use the same instance since the user will have changed screens.
Sub AUDIT_FILE()
'copy account# for pasting into host system
Selection.Copy
'opens host system
Call Shell("C:\uvterm\uvterm.exe", 1)
SendKeys "%F~", Wait:=True
'select host configuration
SendKeys "c:\uvterm\uvterm.cfg~", Wait:=True
' connect to host
SendKeys "%CN~", Wait:=True
' enter user ID
SendKeys "t.user~", Wait:=True
Application.Wait Now + TimeSerial(0, 0, 1)
'enter password#1
SendKeys "pw1234", Wait:=True
SendKeys "~", Wait:=True
Application.Wait Now + TimeSerial(0, 0, 1)
SendKeys "~", Wait:=True
SendKeys "~", Wait:=True
'enter password#2
SendKeys "pw5678~", Wait:=True
'start navigating to the account lookup screen
SendKeys "5~", Wait:=True
SendKeys "1~", Wait:=True
SendKeys "*Q7~", Wait:=True
'at this point the host is ready to accept the account# for lookup
'the following Sendkeys command is the equivalent of Ctrl-V and pastes in
'the account# copied to the clipboard at the the beginning of the script.
SendKeys "^v~", Wait:=True
End Sub
Display More