ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Name disappears after Application.Run (https://www.excelbanter.com/excel-programming/420144-name-disappears-after-application-run.html)

Dean Meyer[_2_]

Name disappears after Application.Run
 
A bug in Excel 2007 causes the name immediately following Print_Titles to
disappear from a workbook after Application.Run has called a routine in the
workbook, then the workbook is closed and reopened.

TO REPLICATE:
Create 2 workbooks: Master.xlsm and Slave.xlsm

In Slave.xlsm, do two things:
1) Name a range QQQ (such that it follows Print_Titles)
2) Create a VB macro called NoOp that does nothing.

In Master.xlsm:
1) Create a VB macro that does:
Application.Run "'Slave.xlsm'!NoOp"

Now, close Slave (with or without saving it), keeping Master open. Reopen
Slave, and the first name following Print_Titles cannot load. It's in the
file, but not in the name manager when the file is loaded.

WORKAROUND: Always ensure there is a name Print_Titles_ZZZZZZ, replace if
missing on WorkbookOpen.

QUESTION: Is there any other damage caused by this bug that I haven't
discovered yet?

TonyR[_2_]

Name disappears after Application.Run
 
Dean,

Thank you for solving a problem which has been driving me crazy for the last
few months.

I think it's not just Application.Run, but any use of the application
object, e.g. Application.Statusbar that makes the next range name after
Print_Area disappear.

Regards,
Tony



All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com