names not working after opening programmatically

VerlindenG

New Member
Joined
Jul 1, 2012
Messages
13
Excel2010 - OfficeXP and Office2010
I have a pretty big workbook with much names defined and used in it.
When I do open this workbook manually, no problem.
But when I open the workbook in VBA (Workbooks.Open (Filename) not one of the names seems to be recognised: every formala referencing a name gives the "#NAME?" error.

- Recalculating doesn't help.
- When I trie creating a new workbook with names, I do not have the same problem, but this is not really an option for the moment being because my actual workbook with the problem is huge.

Has anyone an idea how to get rid of this problem?
 
as far as I saw, yes for your fist question, and yes for sure for your second.
When I remove a name out of a formula, the formula works again (but of course not as I wanted, because there's something missing now). When I put the name back in the formula, formula fails again.
(Only when I close and open the file again but manually, everything's fine. But I would like to open it in VBA. )

What if you put your cursor in the cell, hit F2, and then hit Enter (refresh the formula)?
 
Upvote 0
There's go my big idea. What abour rory's last question ... any auto-open macros?
 
Upvote 0
My point was that auto_open does not run automatically if you open a workbook in code, and perhaps that is the problem. If you add:
Code:
activeworkbook.runautomacros xlautoopen
after the workbooks.open line, does it help?
 
Upvote 0
I was very hopefull ... but, no "activeworkbook.runautomacros xlautoopen" doesn't help.
Anyway, it was not strictly "auto_open" I used, I did use already the more recent "_Open" event.
So: the problem stays.:confused:
 
Upvote 0
That's quite different - an Open event would run automatically unless you set
Code:
application.enableevents = False
somewhere in your code?
 
Upvote 0
What's the reason for opening this large workbook in code in the first place?
 
Upvote 0
What's the reason for opening this large workbook in code in the first place?

Before printing a sheet, I do hide much rows, show other rows that were hidden, and change the colors of certain cells;
so when the end-user asks to print, I first save the workbook in the original layout, and after printing the visible rows and the changed colors, I put the workbook back on screen in the original status, so that the enduser gets again what he had before printing...
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top