Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbook always "changed" 2

Status
Not open for further replies.

RobBroekhuis

Technical User
Oct 15, 2001
1,971
US
After making my exit as an "expert", dare I come back with a question? Well, here goes...
I have an application that reads in data from .csv files, does a boatload of manipulation (adds worksheets, formulae, graphs, etc), and saves as a .xls. Works like a charm. Problem is, every workbook so created behaves oddly in one way: as soon as it is opened, the workbook.saved property is false. This of course prompts Excel to always ask whether to save the file, even if I just open and immediately close it. Rather annoying. The workbooks have just one piece of VBA code - a worksheet_change handler, which does not fire upon opening the workbook. They do not have a workbook_open handler (although I temporarily put one in with just a "stop" command, to try to trace this behavior). There are no application event handlers in place either. I can get around this by placing thisworkbook.saved=true in a new workbook_open handler, but that just doesn't seem right. Anybody have suggestions on what might be causing this?


Rob
[flowerface]
 
Hi Rob - good to see you back again.
The only thing that springs to mind is if there are lots of calcs / array formulae etc ie if the "calculating" + % appears in the status bar, this appears to make excel think that something has changed. I've got a coupla files that do this. One is massive and has a lot of calcs, the other is relatively small but has quite a few array formulae. Both of these workbooks recalc as soon as they are opened and it is this I believe which causes excel to set saved = false - even tho nothing has actually changed

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
Hi Rob!
Does this mean you're back? If so HELLO!!

Not sure of the reason or solution here but I suspect that the workbook is calculating when it is opened and in doing so it changes. Just to see if I'm in the right direction I put the Now() function on a sheet together with a sheet change event, closed to book and opened it. went to close it and same prob - Save changes?

That's all I can think of - calculation on opening!

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
heh heh heh heh - once again Loomah - at least it means that I might be making some sense ;-)
just thought of something else.....Now() will do it as Loomah says but might also be kicked off if you have any UDFs with app.volatile in them

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
Thanks both of you. You put me on the right track to understanding (if not resolving) the problem, which I've now determined to be caused by worksheet function calls to a different (company-wide, not my own) add-in toolbox.
I'm afraid I'm not really "back" - working half-days now, and it's hard enough to cram in the work I'm paid to do :)


Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top