Close Workbook Without Save Changes Dialog

Jan 9, 2009

I'm not sure what I'm missing here, but I am trying to exit a spreadsheet using VBA code without saving changes.

The following code, to my mind, should work, but I keep getting a dialog asking if I want to save changes.


'* ensure workbook does not request user to save it...
ThisWorkbook.Saved = True
'* exit Excel...
Application.Quit

View 9 Replies


ADVERTISEMENT

Suppress Save Dialog On Before Close Event

Jan 5, 2014

I have a command button code on a sheet that checks if all the cells in a table have been completed before saving the worksheet. If they're not all complete a userform message box pops up with a reminder then returns to the sheet without saving. I want to be able to call this from the 'BeforeClose' event as well however, even though it still does what it's supposed to do, after the userform message box has displayed and been unloaded then it still pops up the Save Dialog box.

I'm struggling to suppress the Save Dialog box and return to the sheet.

View 1 Replies View Related

Close File Without "Save Changes" Dialog Box?

Aug 31, 2009

I have a summary file (I'll call it File A) from which a macro is run. It opens other files, finds a "total line" then copies it into File A. Then it closes that file, opens another, and repeats the process. The macro works fine for most of the files it opens and closes, but on some of them, upon the close command, a dialog box pops up asking "Do you want to save the changes you made to "File B.xls"?

I'm not sure why this comes up as there were no changes made. Cells were only copied and pasted into another file. Is there a way to stop this annoying box from popping up? It slows down the macro by waiting for human input. here is my

View 4 Replies View Related

Workbook To Display The Save As Dialog Box

Oct 21, 2008

When a user tries to save a workbook I want the workbook to display the Save As dialog box. This will ensure that the template is not accidentally tempered with.

View 20 Replies View Related

Save And Close Workbook Using VBA

Dec 11, 2013

How can i save and close one workbook in excel with vba code.

View 2 Replies View Related

Save Workbook & Close

Jul 8, 2006

One of my computers pulls info from my cash register once everyday (sales info). Then I have a excel monthly sales sheet that pulls the info from the register info and puts it in the right places. So the computer pulls the register info at 9:20pm everyday, then I have my task manager open excel at 9:25 everyday and it has a workbook open macro to automatically pull the info into the excel spreadsheet. Here's my problem-- I need to close it.

I'm sure I could use a workbook close macro, but when it tries to close it won't it come up with a save, don't save, cancel prompt? Nobody will be there to hit SAVE so it won't close? Is there just a macro that could save it then close it?

View 9 Replies View Related

Save Backup Of Workbook Before Close

Dec 15, 2009

I call the macro below from a Workbook_BeforeClose sub; however, if the user has not saved changes before they hit the close then the Sub SaveFile runs and then after the backup save they are then asked do you want to save changes.

I initially had this sub run with Workbook_BeforeSave, but I don't really want to run this everytime the user selects save.

Any ideas on how to how the save changes first and then the backup?

View 6 Replies View Related

Save, Close, Then Reopen Workbook

Oct 2, 2007

I am testing the following section of code.

Sub Macro1()
Dim NewWB As Workbook, NewName As String
Set NewWb = Workbooks.Add
NewName = Application.GetSaveAsFilename(ThisWorkbook.Name)
NewWb.SaveAs NewName
NewWb.Close False
Workbooks.Open (ThisWorkbook.Path & "/" & ThisWorkbook.Name)
End Sub
It seems like I need to rename the sheet I am working on in order for this code to work. If I do not, it tells me that it "cannot save this workbook with the same name as another open workbook".

I am trying to use this code to get around an error with Excel described here: [url]

I would like to have the sheet save itself (not "Save As"), close, reopen, and continue running the macro. What adjustments do I need to make to this code to do this. I have tried different things, but I must be getting the syntax wrong.

View 9 Replies View Related

Save As And Close Active Workbook

May 13, 2009

I am trying to create a form button that will save as and close the active workbook. I have the Save As code working but I can't find any code to close the workbook that will work. A couple of issues: I don't have control of what the workbook is called - the user will name it - so I can't do a simple Workbooks (" ").Close. Also, I don't want to quit the application. I don't know if the user will have other worksheets open. I also tried ActiveWorkbook.Close and that didn't seem to work either. Not sure what I am doing wrong.

View 9 Replies View Related

Close Workbook Without Save Prompts

Oct 2, 2007

Workbook 1 has references to workbooks 2,3,4,5,6. When I click the top cross and choose Save All with Workbook 1 active, the deactivate event in workbook 6 runs to the end as it tries to close, but it can't close because workbook 1 references it. So nothing further happens until I click the top cross again. Then everything closes without any more prompts. Not good. If I could ensure workbook 1 closes first that should solve the problem. There may be another way of course.

I have attached 2 blank files to show the problem. test1 references test2. Open test1. It will open test2. Make a change to both files, activate test 1 and click the top cross, choose save all. Nothing happens usually.

View 4 Replies View Related

Macro To Open / Close / Save Workbook?

Mar 14, 2014

I need to have a workbook (all of them in a folder, ideally) refresh in the middle of the night. The file is large so the refresh takes a full minute. I know I can't auto refresh a closed workbook (pretty sure anyway), and I can't leave the workbook open for various reasons.

So I'm thinking I could have a macro in an open excel (it kicks off on open) that will open a particular workbook elsewhere (the one I need refreshed), open it, refresh it and close/save it. Ideally it would do this for the entire group of workbooks in the folder but I'd be happy to start with just one. I would like to set it to occur every twelve hours (so at midnight, say, this would occur - I would just have to leave the workbook with the macro in it open on a computer so that it runs and completes this task every night).

View 7 Replies View Related

Open Workbook / Copy / Close Without Offer To Save?

Mar 12, 2014

I've got a kind of "menu" sheet that will pull up various reports from Excel spreadsheets. Rather than having the user work with the live data, the menu opens the file and saves it as a copy, closing the original. This is working fine.

The tweak I want to add is, since the user is looking at a copy rather than the live data, I don't want them to save when closing. Is it possible to programatically add a bit of code to the new copy to handle this?

Here's a sample of one of the menu button's code:

Code:

Private Sub CommandButton18_Click()
Dim wb As Workbook
Set wb = Workbooks.Open(Filename:="J:Z PII OvensRack Repair TrackingRack Repair List.xlsx")
With wb.Worksheets("Sheet1")
.Unprotect Password:="pass"
ActiveWorkbook.Worksheets("Sheet1").Copy
End With

[Code].....

View 7 Replies View Related

Open Workbook, Find Last Row & Paste, Save And Close

Jun 13, 2008

What i need to do is Open a Closed workbook (which i have done in the code below)

1 . When this book opens there is a msgbox that needs to have "template" pasted in to then ok automatically clicked ( i have no clue if this can even be done)

2. Then go to Sheet("contactor info") find last row then paste certain info. Below is a peice of code i have from the open workbook but of corse it doesnt work. The red is where it hangs up.

openpath = ActiveWorkbook.Path & ""
Set wb = Workbooks.Open(openpath & "Template.xls")
With wb.Sheets("Contractor Info")
. Cells(Sheets("Contractor info").Rows.Count, "B").End(xlUp)(2, 1).Select
ActiveCell.Value = Msg1
ActiveCell.Offset(0, 4).Value = Msg2
ActiveCell.Offset(0, 5).Value = Msg3
ActiveCell.Offset(0, 3).Value = Msg5
ActiveCell.Offset(0, 2).Value = Msg4
ActiveCell.Offset(0, 1).Value = Msg6
ActiveCell.Offset(0, 6).Value = Msg7
Application.Calculation = xlCalculationManual..................

View 2 Replies View Related

Date - Sheet To Copy The Info To Another Workbook, Save And Close

May 3, 2007

I have a sheet that users fill out and there is a macro on that sheet to copy the info to another workbook, save and close.

for some reason, the date, which originates from a cell with the value "=Today()", and when pasted in to the new book, it is pasted values.

the issue is, every so often, the date will say 09/26/10 and continue to do so for quite a few entries.

i have tried almost everything. I checked the dates on the computers, and all are fine. i even went through it step by step, and when the data pasted it, it was 09/26/10.

View 9 Replies View Related

Save Workbook On Workbook Close

Aug 26, 2006

I snagged this code out from another project I wrote, and it works fine in that one, but doesn't in the new project.

What I want, is when the person presses the exit button, it will save whatever was done, its running as a form printer and database. The code below is the code for my exit button.

Private Sub CommandButton4_Click()
Dim sAnswer As String
Dim i As Integer

' ****************
' ** Exit Button**
' ****************

When it gets to "If ActiveWorkbook.Saved = False Then" it does put the question out "Do you want to save changes" I click Yes and it doesn't save it.. I have tried both activeworkbook and thisworkbook ... I copied the code and verified all is good to go..

View 9 Replies View Related

Excel 2007 :: VBA To Save And Close All Open Workbooks Except Macro Workbook?

Mar 8, 2013

I have a macro that opens all workbooks from one directory and runs a macro for each workbook to clean up the data. I cannot figure out how to take all those open workbooks and save them to another directory and close the workbook. Also, I do not want the macro workbook (xlsm) to save. I only want it to close. I am working in 2007 Excel.

View 8 Replies View Related

Auto Save And Close Workbook After User Defined Length Of Idle Time

Dec 5, 2008

I have a workbook, "A", that while open I need to be able to detect any type of activity within other open Excel workbooks "B...Z" that are simultaneously open.

I understand that I would need to use the Class Module with a Public WithEvents function but I am stuck here.

View 5 Replies View Related

ActiveX Combobox - Linked Cell Reference Lost After Save / Close And Re-open Workbook

Feb 11, 2013

Using the developer tab I inserted an Active X combo box. Under properties I referenced a 'linked cell' that I want the data to appear in. This box works great as long as I keep the sheet open. Once I save and close the workbook and re-open, that reference is lost. It shows #REF! in that field. Why does it lose the reference? I have tried to reference a cell on the same sheet as well as a cell in a different sheet and it keeps the sheet name but not the individual cell.

View 13 Replies View Related

Macro To Check If Saved Then Save Else Bring Up Save As Dialog

Sep 6, 2012

I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .

The macro itself is saved in personal.xlsx.

View 1 Replies View Related

Customize Look In/Save In (My Places) In Open/Save As Dialog Boxes

May 10, 2008

I would like to add some icons on the left side of excel open file pane to faciliate my work. Because i need to load some files under the same folder many times a day. Does anybody know how to do that? I've seen people has more icons on the pane before. The defaut setting has only 'History', 'My Documents', 'Favorites', 'Desktop' and ' My nutwork places' on it.

View 2 Replies View Related

Close Find Dialog After Value Found

Jul 12, 2007

Related to my thead here, is there a way that the Find dialog can be automatically closed after the find?

View 7 Replies View Related

VBA Project Password Dialog Shows On Close

Sep 17, 2007

Here's a problem that I having and I'm wondering if someone could give me some insight as to why this is happening.

Hist of Issue:
Most of my projects for my employer are required to run various times of the day and various days of the week. So in order to accomplish this I use the "Digital Signature" to sign my apps so that when setting macro security to Medium they will still run.

When a particular app loads there is a Userform that I created which displays and allows the user to bypass automatic execution. This allows me to be able to work on the workbook without having to abort any automatic executing code. See "MyAutoStart.JPG" for an example of this.

Now somewhere down the line, and I'm not sure when though, up until this point I was living with the problem and now I must solve it. What happens is that I have a project that when it runs and then closes it displays the dialog box which asks for the VBA Project password.

View 9 Replies View Related

Code, That Disables Save, Save As And Close Commands

Nov 2, 2009

Each of the worksheets in my model use A1 as a control cell for any errors and inconsistencies. My aim is to disable save and close commands in case A1 is not equal to 0 in any of the worksheets.

The code I currently use for that purpose is as follows.

View 2 Replies View Related

Add-In And Save Dialog-Box

Oct 21, 2008

I'm building my first Add-In, which I'm using to gather all Sub's that I've created through my small VBA writting career. The thing is that when I write new code and some reason exit Excel and forget to save the XLA, obviously the code is lost. I've used:

View 4 Replies View Related

Compile Error On Close Of Excel 2003 But Not On Close Of Workbook

Mar 22, 2012

I am using Excel 2003.

It’s been working perfectly up until around an hour ago. However, now when I close Excel, I get compile errors.

These compile errors seem to be because Excel is trying to access controls in the workbook after it has closed. Since the workbook is closed, VBA can no longer ‘see’ the controls, and therefore it thows up errors.

I’m also getting a similar error on a Worksheets("DataExplorer").unprotect line, which seems to be because the worksheet isn’t there after closing.

These errors only occur when I close the whole excel application using the big cross in the top right. If I just close the workbook (using the smaller cross just below the big cross in the top right of excel), it doesn’t throw up these errors.

Just to clarify: all of the code runs perfectly when Excel is open. The errors are being thrown up for lines of code which run without problem until Excel is closed.

View 9 Replies View Related

Save File Dialog Box

Jun 18, 2009

what command can i use to bring up the save as dialog box ( where to name your saved file) if my file is already named?

View 2 Replies View Related

Save Dialog Box Cancel

Jun 19, 2009

How can this be edited so when the savebox comes up when i hit save it saves the file but when i hit cancel it goes to error:

View 14 Replies View Related

Pre-populate Save As Dialog Box

May 26, 2006

How can i call the Save As dialog box from a macro, and pre-populate the filename field with a cell value from the workbook? I have tried this code

With Application.Dialogs(xlDialogFileSaveAs)
.Name = Sheets("Calcs").Range("b37").Value
.Show
End With

with the cell reference being what i want to show in the filename box. Each time i run it, i get an error message, "run time error 1004, application defind or object defined error"

View 7 Replies View Related

Saving File With Save As Dialog Box

Dec 14, 2006

I want to be able to have the Save As dialog box come up, but with a File Name already chosen, so that the user can save it as this File Name in any location he/she wishes. I can get the Save As dialog box coming up with my code, but I don't know how to automatically enter the File Name

View 4 Replies View Related

Macro To Bring Up Save As Dialog Box

Feb 20, 2007

I am modifying a corporate macro that is used in to create a standard technical letter. This standard file has 6 macros, that once used to create the letter, are never used again. I know, the first thing that jumps out is to create an add-in. I'd prefer not to got hat route at the moment for various reasons.

What I'm looking to do is after the letter is created, and the print macro is called and prints the letter, all macros are removed (already found help for this on this site), then check to see if the file has been saved, or still has the template name, and then either save or bring up the save as dialog box for the user to save the file with the appropriate name and folder.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved