0

We have a macro enabled workbook (ver. 2010) that many people use. A few of these people have macros in their Personal.xlsb workbook. We have a situation where the macro in the shared workbook is named the same as a macro in personal workbooks but does slightly different things.

To avoid running the wrong macro, I'd like to default the shared workbook to run macros from This Workbook instead of All Open Workbooks. I expect to place something in WorkBook_Open(), but what?

Is there a way to change the default option for Macros in: All Open Workbooks to This Workbook?

2 Answers 2

0

Can you guys just rename the macro in the shared workbook and replace the instances of that macro in that specific workbook?

1
  • We could but that doesn't prevent this from happening again.
    – B540Glenn
    Jan 27, 2016 at 18:49
0

If I rename the modules that hold the subroutines, I can specify exactly which sub to call.

Example:
In Modlue1, renamed to LocalModule1, I have:

Sub TestDupe()
    Call LocalModule1.DuplicateName
End Sub

Public Sub DuplicateName()
    ActiveSheet.UsedRange
    MsgBox ("new mod 1")
End Sub

In Module2, renamed to be LocalModule2, I have

Public Sub DuplicateName()
      ActiveSheet.UsedRange
      MsgBox ("mod 2")
End Sub

By changing the qualifier in the call from LocalModule1 to LocalModule2, I can now dictate which same-named subroutine to execute.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .