Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Oct 2002
    Blue Mountains, New South Wales, Australia
    Thanked 0 Times in 0 Posts

    Open file disable macros (Excel 97/vba)

    I have a macro in an excel workbook which opens another excel workbook. I wish to DISABLE MACROS in the second workbook, read from it, then close without saving changes.
    Workbooks.Open sFile 'sFile is variable with path+name of second workbook
    sFormName = ActiveWorkbook.Name
    Workbooks(sFormName).Close SaveChanges:=False, routeworkbook:=False

    Can anyone help me disable all macros within sFile when it opens.

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Weert, Limburg, Netherlands
    Thanked 0 Times in 0 Posts

    Re: Open file disable macros (Excel 97/vba)

    You cannot disable macros for workbooks opened using VBA, but you CAN prevent their Workbook_Open macro from running:

    Workbooks.Open sFile
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts