Excel/Open Workbook

Advertisement


Question
Good day Jerry ,
I have this code line as the first line in Workbook_Open() Module
If ThisWorkBook.Name <> "MyBook1.xlsx" then ThisWorkBook.Close
I changed the workbook name so it closes itself momentarily each time I try to open it.
I can not remember the original name!
Is there a method to keep it open even if it has this code line?
Thanks in advance for your time.

Hadi

Answer
MyBook.xlsx does not allow macros to run at all.  I cannot imagine that workbook closing itself.

If the file you're opening is a .xlsm file, just change the extension to .xlsx and the macros won't fire.   They will still be there until you save the file again, at that point the .xlsx extension will cause them to be deleted.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jerry Beaucaire

Expertise

Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files

Experience

Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files ===================== I have been offering free assistance as an Excel aid on many web sites for many years: (http://www.excelforum.com - JBeaucaire) ======== (http://www.askmehelpdesk.com/spreadsheets - JBeaucaire) ======= (http://www.mrexcel.com/forum - jbeaucaire)

Education/Credentials
Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2016 About.com. All rights reserved.