• Disabling macros when opening workbook from VB

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Disabling macros when opening workbook from VB

    Author
    Topic
    #465789

    I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    Viewing 15 reply threads
    Author
    Replies
    • #1199547

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1199972

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1200728

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1201647

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1202418

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1203297

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1204132

      I am running a macro from Excel that opens other Excel workbooks with Workbooks.Open. Some of those workbooks have macros that automatically run when opened, and that is causing a problem. Does anyone know how to disable the macros of a workbook being opened from VB. When manually opening, one gets a prompt to Enable Macros or Disable Macros, but what is the equivalent in VB?

    • #1198474

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1199686

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1200069

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1200796

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1201715

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1202486

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1203395

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1204230

      I just ran a quick test to refresh my memory and Auto_Open macros do Not run when the workbook is
      opened by Workbook.open.

      Do you have some other types of auto execute macros, perhaps triggered by an event?

      RG

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1204341

      To prevent Workbook_Open from running you can put
      Application.EnableEvents=False
      just before the macro opens the file.

      DO remember to turn those back on!
      Application.EnableEvents=True

      As of Excel 2007, you can disable macros:

      application.AutomationSecurity=msoAutomationSecurityForceDisable

      This also needs to be reset to the previous setting. Look in VBA help for more information

    Viewing 15 reply threads
    Reply To: Disabling macros when opening workbook from VB

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: