ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sendkey method for forms (https://www.excelbanter.com/excel-programming/359044-sendkey-method-forms.html)

reachthepalace[_4_]

sendkey method for forms
 

I have a sub that calls a form. The form has some code to check data
select range etc. I want the sub or form to click "OK" command once i
does the checks without user interference.

From the forum, I got the key as
Application.sendkeys("{Enter}")

But where do I put this line? In the form or in the sub calling th
form?

Sub calls the form
Form is shown
Form executes whatever, required fields are populated
<code executes the OK
control returns to the sub
does a bunch of things

Thanks all for the hel

--
reachthepalac
-----------------------------------------------------------------------
reachthepalace's Profile: http://www.excelforum.com/member.php...fo&userid=3172
View this thread: http://www.excelforum.com/showthread.php?threadid=53344


Chip Pearson

sendkey method for forms
 
I assume that clicking Enter causes a command button click. In
that case, you can just call the command buttons Click procedure
directly.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"reachthepalace"
<reachthepalace.26f1i0_1145289605.6781@excelforu m-nospam.com
wrote in message
news:reachthepalace.26f1i0_1145289605.6781@excelfo rum-nospam.com...

I have a sub that calls a form. The form has some code to check
data,
select range etc. I want the sub or form to click "OK" command
once it
does the checks without user interference.

From the forum, I got the key as
Application.sendkeys("{Enter}")

But where do I put this line? In the form or in the sub calling
the
form?

Sub calls the form
Form is shown
Form executes whatever, required fields are populated
<code executes the OK
control returns to the sub
does a bunch of things

Thanks all for the help


--
reachthepalace
------------------------------------------------------------------------
reachthepalace's Profile:
http://www.excelforum.com/member.php...o&userid=31729
View this thread:
http://www.excelforum.com/showthread...hreadid=533449





All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com