vendredi 27 février 2015

Userform is not being shown in other workbook

I have a workbook with a userform. Then I have 2 procedures to show and hide this form in a code module of this workbook respectively.


In workbook module I have have assigned an onkey event to show this userform.


The Problem:


When I am on excel 2010 or 2013 and press this combination this menu is shown in irrespective of which workbook is active. Whereas in excel 2007 this key combination only works when this workbook is active.


Have tried checking the show hide procedure those are also not visible in another workbooks so even I cannot run then too by selecting from Macro list (Alt + F8).


How to show this userform on any of the active workbook in excel 2007 too?


Below is a link for a sample workbook:


This is in ThisWorkbook



Private Sub Workbook_Open()
Application.OnKey "^{s}", "showForm"
End Sub


The following is in the Module 1 of the workbook:



Sub showForm()
UserForm1.Show
End Sub


Sub hideForm()
UserForm1.Hide
End Sub


Now this Alt + S shortcut to bring userform in view while other workbook is active is working only in excel 2010 and 2013 but not 2007.


http://ift.tt/1AR2Vgo


Aucun commentaire:

Enregistrer un commentaire