×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Multiple Files with VBA Macros Using same Shortcut Key

Multiple Files with VBA Macros Using same Shortcut Key

Multiple Files with VBA Macros Using same Shortcut Key

(OP)
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?



'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()

'Any code in this proceedure, but I've left my original code as an example

'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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources