Execute Code

G

gti_jobert

Hi all,

I want to execute all the code in a cmdButton on a userform when a
keypress is registerd.


Code:
--------------------

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 10Then
'goto cmdSearch (execute the cmdSearch Code)
End If
End Sub
 
T

tony h

move the code inside the command button routine into a general modul
(create the module using insert...module and call it as a public sub

eg
public sub doCMD

end sub


then change the cmdbutton code to call doCMD and the keypress i
ascii=10 to call docmd

Hope this helps
regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top