![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 10
|
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 .MacoOptions method appears to work in every other respect.
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 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 " End Sub Sub ToggleVertOutline() '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, 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 [code] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Hi Bruce, do all of your Workbooks have this code in them ??
Or just ONE. The reason I ask is that If you just have this in one workbook the routine only fires When that workbook is Activated. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 10
|
Very prompt!
All workbooks have similar code. The last proceedure in my example should have your own code in it, as the particular code I have posted needs a particular sheet and outline to be present Bruce |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|