Minggu, 04 Januari 2015

Re: [ExcelVBA] Stopping calculation and iterations before save.

 

Thank you Daniel,


I understand what those parameters are useful for, I just wonder (same as for the Workbook_beforeclose), why the parameters are required.

But since I wrote my first post (or better said the second, where I made the correction), I remembered that if I wanted something to be done, I had to write application.run referring to another module.sub, and not inside the workbook code sheet.

So now, I can turn off the calculations before I save.
And restore them before close.

But anyway, I might not need it anymore, because I think that when I wrote this code, EVERYTHING was so slow.
After exiting Excel et restarting the computer, saving wasn't that bad even with calculations…

All this took me time, but I have learned something new, once again.

Thanks again,

Louise



Le 2015-01-04 à 00:15, 'Daniel Lamarche' daniel@comboprojects.com [ExcelVBA] <ExcelVBA@yahoogroups.com> a écrit :

Microsoft Help specifies the following:





Private Sub Workbook_BeforeSave (SaveAsUI, Cancel)




SaveAsUI 


Required


Boolean 


True if the Save As dialog box will be displayed.




Cancel 


Required


Boolean 


False when the event occurs. If the event procedure sets this argument to True, the workbook isn't saved when the procedure is finished.





More than once I have to prevent saving a document because some conditions were not met.  So If condition is not met then put True as second parameter. If SaveAsUI = True the SaveAs dialog box is shown.





Daniel





From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] 
Sent: Sunday, 4 January 2015 11:32 AM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Re: Stopping calculation and iterations before save.








Sorry about the previous code: 


I copied it from a previous text that I had written outside of Excel.





Private Sub Workbook_BeforeSave() 


provokes an compiling error.





The code that does not work is written in my Workbook as:





Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _ 


Cancel as Boolean)


With Application 
.Iteration = False 
.Calculation = xlManual 
.CalculateBeforeSave = False 
End With 


End Sub





By the way, I do not quite understand why the parameters are required.

























[Non-text portions of this message have been removed]




------------------------------------
Posted by: "Daniel Lamarche" <daniel@comboprojects.com>
------------------------------------

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA. 

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/ExcelVBA/

<*> Your email settings:
   Individual Email | Traditional

<*> To change settings online go to:
   http://groups.yahoo.com/group/ExcelVBA/join
   (Yahoo! ID required)

<*> To change settings via email:
   ExcelVBA-digest@yahoogroups.com 
   ExcelVBA-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
   ExcelVBA-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
   https://info.yahoo.com/legal/us/yahoo/utos/terms/

__._,_.___

Posted by: =?iso-8859-1?Q?Louise_Gari=E9py?= <garilou@cgocable.ca>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar