Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 consecutive SendKeys commands

Status
Not open for further replies.

lancos

Programmer
Dec 13, 2000
3
0
0
JP
From a VBA script, I send 2 SendKeys commands which opens 2 dialogs.

SendKeys "%feu" & StrFileName &"{Enter}"
Debug.print "Hello"
Wait 1
Debug.print "Hello2"
Sendkeys "{right}"+"{right}"+"{enter}"

The first command will open a Save as dialog, enter the file name path and close the dialog. After closing this dialog, a second dialog is automatically opened by the software under which the VBA macro runs. The second Sendkeys command should close the second dialog. However, it seems that the second command is not executed and the second dialog remains opened. Hello is displayed in the immediate window but not hello2

Any ideas of workaround?

 


Maybe!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Try the send keys equivalant for alt f and then c which for Excel closes the workbook. If possible just do a with statment that has .close in it.

Also I haven't ever had luck with wait 1 and have had to do Application.Wait(Now + TimeValue("0:00:01"))
 
What software are you running? Why are you using SendKeys?
 
This sounds very similar to my issue.

I have an Access based VBA module that launches an Excel macro. In turn that Excel macro loads an Oracle userform. I have been searching for a way to fill in the Oracle userform from my Access program, but I can't find any discussions related to this.

When Access launches the Excel macro, control is transferred to Excel and then to the Oracle userform. Additional lines of code in Access are not acted upon until control is returned to Access.

I've started researching "hooks" to see if that would work, but I'm having trouble understanding how they are properly used to trap the Oracle userform and then pass information to that form from within Access.

Does anyone have ideas on the best way to approach this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top