ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suppressing Input Box (https://www.excelbanter.com/excel-programming/418604-suppressing-input-box.html)

Orion Cochrane

Suppressing Input Box
 
I have an application that prompts me to enter data on startup into an input
box and after saving. I also have a Workbook_BeforeClose event that saves the
file when closing, but it calls the BeforeSave event I have. Is there a way
to save without calling the BeforeSave event?
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.

Orion Cochrane

Suppressing Input Box
 
I forgot to mention the procedure that incorporates the input box (in
ThisWorkbook):

Private Sub Deposit()
Application.StatusBar = something
Range("A1").Value = InputBox(Prompt, Title)
Call Messages.Messages
End Sub

As a reference, here are the occurrences of this procedu

Private Sub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, Cancel As Boolean)
'Performs actions of Workbook_BeforeClose but does not close the workbook
when complete
Call Workbook_BeforeClose(True)
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Resets workbook and saves file
Sheets(1).Select
Range("All").ClearContents
Range("A3").Select
If Cancel = False Then
ThisWorkbook.Save
Application.StatusBar = False
End If
If Cancel = True Then Call Deposit
End Sub

Chip Pearson

Suppressing Input Box
 
You can use the EnableEvents property to prevent Excel from calling
event procedures. E.g,

Application.EnableEvents = False
' save the file. won't call BeforeSave
Application.EnableEvents = True

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 16 Oct 2008 09:41:00 -0700, Orion Cochrane
wrote:

I have an application that prompts me to enter data on startup into an input
box and after saving. I also have a Workbook_BeforeClose event that saves the
file when closing, but it calls the BeforeSave event I have. Is there a way
to save without calling the BeforeSave event?


Orion Cochrane

Suppressing Input Box
 
Perfect! This will help me with other applications I use. Thanks, Mr. MVP
(Most Valuable Programmer) :)
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.


"Chip Pearson" wrote:

You can use the EnableEvents property to prevent Excel from calling
event procedures. E.g,

Application.EnableEvents = False
' save the file. won't call BeforeSave
Application.EnableEvents = True

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 16 Oct 2008 09:41:00 -0700, Orion Cochrane
wrote:

I have an application that prompts me to enter data on startup into an input
box and after saving. I also have a Workbook_BeforeClose event that saves the
file when closing, but it calls the BeforeSave event I have. Is there a way
to save without calling the BeforeSave event?




All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com