Custom Key Strokes Not Working When Multiple Workbooks Are Open

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
701
Office Version
  1. 365
Platform
  1. Windows
I customized some key strokes to launch forms in two different workbooks. For some reason, if I have multiple workbooks open, the custom key strokes no longer work, but they do work when only one workbook is open.

Here's the code that I have. Both are stored in their respective ThisWorkbook objects.

FLP Workbook
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "^\"
End Sub
Private Sub Workbook_Open()
Application.OnKey "^\", "LoadFLRTemp"
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
    If Not ws.Name = "Variables" Then
        If ws.FilterMode = True Then
            ws.ShowAllData
        Else
        End If
        With ws.UsedRange.Cells
            .Font.Name = "Calibri"
            .Font.Size = 10
            .Borders.LineStyle = xlContinuous
            .EntireColumn.AutoFit
        End With
    End If
Next ws
Application.ScreenUpdating = True
End Sub


OD_Dep Workbook
Code:
Private Sub Workbook_Open()
frm_ODDepFrontPage.Show
Application.OnKey "^=", "LoadODDepFrontPage"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "^="
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
have you tried
Dim wb as workbook

then using that like worksheets to ensure the application knows where it should be running
 
Upvote 0
I haven't, but that's because I figured since the code was stored in "ThisWorkbook", that I wouldn't need to. However, I'll give it a try.
 
Upvote 0

Forum statistics

Threads
1,215,584
Messages
6,125,673
Members
449,248
Latest member
wayneho98

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top