Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserForm

  • Thread starter Thread starter halimnurikhwan
  • Start date Start date
H

halimnurikhwan

Hi all,

Somebody I wish to solve this ,,,
Ia have a userform that interact with a WorBook,
All I want now is to save that WorkBook from active UserForm
by press Ctrl+s ...

Somebody please help me...

May be Mr. Tom Ogilvy the MVP can to this or someone else please ...!

Thanks and Regards,

Halim
 
Assume the useform is modal.
Maybe something like this code in the userform module

Private Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer

Const VK_CONTROL As Integer = &H11 'Ctrl


Private Sub TextBox1_KeyDown(ByVal KeyCode _
As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim ctrl as Boolean
If GetKeyState(VK_CONTROL) < 0 Then _
ctrl = True Else ctrl = False
If KeyCode = 83 Then
If ctrl Then
KeyCode = 0
ThisWorkbook.Save
End If
End If
End Sub

You would need to use the KeyDown event of all controls on the Userform.
 
thank you very much for your quick reply ...

But unfortunately I can't always online because
of my office rule that not allow pc client always
online... but I'll try this. ..

thanks againn ...

Regards,

Halim
 
Hi Mr. Ogilvy,

that's work ...
I've tried the procedure keydown but there still a bug that "s" letter
is occured
and typed in the texbox that setfocus...

I use sendkey "{BackSpace}" to clear "s" in the texbox ...

Is there other way to do that ?

thanks,

Halim
 

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

Back
Top