BruceMutton
Geotechnical
- Sep 4, 2001
- 15
I have multiple simultaneously open files that have similar VBA code, and use identical shortcut keys, Ctrl+shift+V in this case. The problem is that excel97 & excel2000 does not seem to recognise more than one shortcut key allocation, and my attempt below to get each file to stamp its own shortcut key does not solve the problem, although the .MacroOptions method appears to work in every other respect.
Any clues to a solution out there?
Application.MacroOptions
_
Macro:="'" & Me.Name & "'!ThisWorkbook.ToggleVertOutline", _
Description:="Ctrl+shift+V " & String(1, 10) & _
"Toggles vertical outline of ActiveSheet " & String(1, 10) & _
"Will act only on THISWorkbook", _
HasShortcutKey:=True, _
ShortcutKey:="V", _
StatusBar:="Toggles vertical outline of ActiveSheet "
'Any code in this proceedure, but I've left my original code as an example
Any clues to a solution out there?
Code:
'This code resides in ThisWorkbook CodeModules
Private Sub Workbook_Activate()
Call MacroShortCutKeyOverRideSetup
End Sub
Private Sub MacroShortCutKeyOverRideSetup()
'Set up for activation of Outline Macro shortcut keys & UI dialog
'Hopefully ensures that other workbooks do not have control of this key, but it does not have that effect!?
MsgBox "About to set Vert Macro shorcut", vbOKOnly, Me.Name
'Vert Comb* outline
_
Macro:="'" & Me.Name & "'!ThisWorkbook.ToggleVertOutline", _
Description:="Ctrl+shift+V " & String(1, 10) & _
"Toggles vertical outline of ActiveSheet " & String(1, 10) & _
"Will act only on THISWorkbook", _
HasShortcutKey:=True, _
ShortcutKey:="V", _
StatusBar:="Toggles vertical outline of ActiveSheet "
Code:
End Sub
Sub ToggleVertOutline()
Code:
'Toggle outline for CiRCSTRess RCDesign Workbook
'Assumes only two levels of outline, 1 and 2
'Mostly seems to work if used on VBA created outlines
'Called from User Interface Ctrl+shift+V
'Created by Bruce Mutton 030102
'Edited by
If LCase(Left(ActiveSheet.CodeName, ) <> "rcdesign" Then Exit Sub
With ActiveSheet
If .Rows(10).Hidden Then
.Outline.ShowLevels RowLevels:=2 'rows expanded
Else
.Outline.ShowLevels RowLevels:=1 'rows collapsed
End If
End With 'ActiveSheet
End Sub