Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JohnUK
 
Posts: n/a
Default Changing Defaults in VBA

When saving a document using VBA it would always default
to either saving with changes or without (as an example)
What do I enter into the code that would force it into
doing otherwise?
Many thanks in advance
John
  #2   Report Post  
Dana DeLouis
 
Posts: n/a
Default

If I am not mistaken, when you "save" a document, the changes will be saved.
However, when you "close" a document, you have the option of saving changes
or not.

Workbooks("BOOK1.XLS").Close SaveChanges:=False ' or True

You may want to look at the "Saved" property also.
You can fake excel into thinking the workbook was saved, then close it.

ThisWorkbook.Saved = True
ThisWorkbook.Close

I hope I understood the question correctly.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in message
...
When saving a document using VBA it would always default
to either saving with changes or without (as an example)
What do I enter into the code that would force it into
doing otherwise?
Many thanks in advance
John



  #3   Report Post  
JohnUK
 
Posts: n/a
Default

Thanks Dana, I will give this a go. The problem I have is
that a few of my workbooks run macro's automaticaly when
opened, and because i am working on a project that brings
in 12 workbooks information into one, I dont want them to
save the changes, hence the wanting to change the
defaults. I am sure this would also help me in other
projects also.
Many thanks again
John
-----Original Message-----
If I am not mistaken, when you "save" a document, the

changes will be saved.
However, when you "close" a document, you have the

option of saving changes
or not.

Workbooks("BOOK1.XLS").Close SaveChanges:=False ' or True

You may want to look at the "Saved" property also.
You can fake excel into thinking the workbook was saved,

then close it.

ThisWorkbook.Saved = True
ThisWorkbook.Close

I hope I understood the question correctly.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in

message
...
When saving a document using VBA it would always

default
to either saving with changes or without (as an

example)
What do I enter into the code that would force it into
doing otherwise?
Many thanks in advance
John



.

  #4   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Just throwing out an idea. If you open certain workbooks often, and know
that you do not want to save changes, perhaps add something like this to the
"ThisWorkbook" module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

When this workbook is closed, Excel will think that the data has been saved,
and won't prompt to save anything.
Another option to throw out. In Personal.xls, I have a class module that
intercepts the closing of all workbooks. If the workbook has a certain
document property set, the macro will set the saved property to true. For
example, a certain template imports data, and generates reports, When I
click close, I do not want this saved (I would run the macro again for more
current data). I would add a document property to this template that tells
the closing macro not to bother saving changes. Again, just an idea.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in message
...
Thanks Dana, I will give this a go. The problem I have is
that a few of my workbooks run macro's automaticaly when
opened, and because i am working on a project that brings
in 12 workbooks information into one, I dont want them to
save the changes, hence the wanting to change the
defaults. I am sure this would also help me in other
projects also.
Many thanks again
John
-----Original Message-----
If I am not mistaken, when you "save" a document, the

changes will be saved.
However, when you "close" a document, you have the

option of saving changes
or not.

Workbooks("BOOK1.XLS").Close SaveChanges:=False ' or True

You may want to look at the "Saved" property also.
You can fake excel into thinking the workbook was saved,

then close it.

ThisWorkbook.Saved = True
ThisWorkbook.Close

I hope I understood the question correctly.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in

message
...
When saving a document using VBA it would always

default
to either saving with changes or without (as an

example)
What do I enter into the code that would force it into
doing otherwise?
Many thanks in advance
John



.




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
I entered 11/22/2004 in excel workbook and it keeps changing to ## Firefly Excel Worksheet Functions 1 February 24th 05 06:11 PM
How do I set my webpage to automatically update a changing spread. kluelessinky Excel Discussion (Misc queries) 0 February 10th 05 01:43 PM
Changing the Direction of Data within a Column Michael Parsons Excel Worksheet Functions 1 January 27th 05 06:52 PM
Changing Dates in Excel Jackie Excel Worksheet Functions 3 January 14th 05 08:16 PM
How can I change size of the picture without changing chartobject? Marie J-son Charts and Charting in Excel 6 December 7th 04 12:34 PM


All times are GMT +1. The time now is 05:46 PM.

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"