Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook.Saved problem - bug or feature?

I can't figure this one out, and it's driving me NUTS. Would
appreciate it if someone could point me in the right direction. I
have an application developed in Excel, which creates a new workbook,
writes out some data to it, saves it - and then leaves it open for the
user to view.

The problem I'm getting is the save status (Workbook.Saved property)
in the generated workbook is changing from True to False, when I
change a value in the *originating* workbook. Here's an example of
some tests I did in debug mode in the immediate window, following a
call to dbook.SaveAs ('dbook' references the generated workbook):

'
' Check current status of generated workbook
'
print dbook.Saved
True
print dbook.Name
netapp-bfgp1-APP01234-rd-20071022-0903-v1.xls
print dbook.Sheets("Audit History").protectcontents
True

'
' Check current status of originating workbook
'
print thisworkbook.Name
NAS Template Generator v2.0a.xls
print thisworkbook.Sheets("Audit History").protectcontents
True

'
' Unprotect the Audit History sheet in the originating workbook
' and view cell A2 of this sheet in both workbooks
'
thisworkbook.sheets("Audit History").unprotect "password"
print dbook.Saved
True
print thisworkbook.sheets("Audit History").range("A2").value
Event ID
print dbook.sheets("Audit History").range("A2").value
Event ID

'
' Change cell A2 in the originating workbook
'
thisworkbook.sheets("Audit History").range("A2").value = "Event ID2"

'
' Has it changed?
'
print thisworkbook.sheets("Audit History").range("A2").value
Event ID2

'
' And has it changed in the new workbook? (it shouldn't have because
' there are no formulas in this sheet, just plain values!)
'
print dbook.sheets("Audit History").range("A2").value
Event ID

'
' So.....?
'
print dbook.Saved
False


I'm baffled. Why has dbook been flagged as modified? Anyone??
What's going on here? The Audit History worksheet is nothing special,
it's just a spreadsheet with some values in it. No formulas. No
references from any other worksheet to the Audit History worksheet.
I've tried it with other worksheets and the same problem. It seems
whatever I change in the originating workbook, affects the save status
of the design workbook.

Please help!

Thanks in advance,
Mark.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Workbook.Saved problem - bug or feature?

It might see the unprotect as a change and therefore would set the flag to
save the file.

"Mark" wrote:

I can't figure this one out, and it's driving me NUTS. Would
appreciate it if someone could point me in the right direction. I
have an application developed in Excel, which creates a new workbook,
writes out some data to it, saves it - and then leaves it open for the
user to view.

The problem I'm getting is the save status (Workbook.Saved property)
in the generated workbook is changing from True to False, when I
change a value in the *originating* workbook. Here's an example of
some tests I did in debug mode in the immediate window, following a
call to dbook.SaveAs ('dbook' references the generated workbook):

'
' Check current status of generated workbook
'
print dbook.Saved
True
print dbook.Name
netapp-bfgp1-APP01234-rd-20071022-0903-v1.xls
print dbook.Sheets("Audit History").protectcontents
True

'
' Check current status of originating workbook
'
print thisworkbook.Name
NAS Template Generator v2.0a.xls
print thisworkbook.Sheets("Audit History").protectcontents
True

'
' Unprotect the Audit History sheet in the originating workbook
' and view cell A2 of this sheet in both workbooks
'
thisworkbook.sheets("Audit History").unprotect "password"
print dbook.Saved
True
print thisworkbook.sheets("Audit History").range("A2").value
Event ID
print dbook.sheets("Audit History").range("A2").value
Event ID

'
' Change cell A2 in the originating workbook
'
thisworkbook.sheets("Audit History").range("A2").value = "Event ID2"

'
' Has it changed?
'
print thisworkbook.sheets("Audit History").range("A2").value
Event ID2

'
' And has it changed in the new workbook? (it shouldn't have because
' there are no formulas in this sheet, just plain values!)
'
print dbook.sheets("Audit History").range("A2").value
Event ID

'
' So.....?
'
print dbook.Saved
False


I'm baffled. Why has dbook been flagged as modified? Anyone??
What's going on here? The Audit History worksheet is nothing special,
it's just a spreadsheet with some values in it. No formulas. No
references from any other worksheet to the Audit History worksheet.
I've tried it with other worksheets and the same problem. It seems
whatever I change in the originating workbook, affects the save status
of the design workbook.

Please help!

Thanks in advance,
Mark.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save column J of WorkBook when WorkBook is not saved. mikeburg[_84_] Excel Programming 2 June 14th 06 09:57 PM
Date(Y,M,D) 'feature' or problem? Jon McP Excel Worksheet Functions 10 November 16th 05 05:41 PM
Search feature in workbook nkt122866 Excel Worksheet Functions 0 September 14th 05 10:24 PM
how do I synchronize shared workbook feature in WSS? Alchemist Excel Discussion (Misc queries) 0 July 22nd 05 11:33 AM
How can I see a copy of a saved workbook before I saved it again? Norma Excel Worksheet Functions 2 May 11th 05 10:31 AM


All times are GMT +1. The time now is 05:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"