ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserForm (https://www.excelbanter.com/excel-programming/368784-hi-mr-ogilvy-how-ctl-s-save-workbook-active-userform.html)

[email protected]

Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserForm
 
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


Tom Ogilvy

Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserForm
 
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.

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
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




[email protected]

Hi Mr. Ogilvy how to Ctl+s to save workbook from Active 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


[email protected]

Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserForm
 
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


Tom Ogilvy

Hi Mr. Ogilvy how to Ctl+s to save workbook from Active UserFo
 
I put in code I though would prevent that and it worked for me. The line
Keycode = 0

--
Regards,
Tom Ogilvy

" wrote:

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




All times are GMT +1. The time now is 04:49 PM.

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