what is the code to close a file for a macro

I need to close a file in a macro but I am not sure how to do it.   I could 
use the following but when I use this a pop up screen says do you want to 
save the changes to the file.  I don't want to save the changes.  Is there 
any code to use that will eliminate the pop up asking me to save the file.

ActiveWindow.Close



----
Celia
0
Utf
4/2/2010 2:23:01 AM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
658 Views

Similar Articles

[PageSpeed] 26

Worbooks("Book.xls").Close SaveChanges:=False



-- 
Regards
Dave Hawley
www.ozgrid.com
"Celia" <Celia@discussions.microsoft.com> wrote in message 
news:99DDAB63-FAFE-4276-9EE7-0288AE465B4E@microsoft.com...
>I need to close a file in a macro but I am not sure how to do it.   I could
> use the following but when I use this a pop up screen says do you want to
> save the changes to the file.  I don't want to save the changes.  Is there
> any code to use that will eliminate the pop up asking me to save the file.
>
> ActiveWindow.Close
>
>
>
> ----
> Celia 

0
ozgrid
4/2/2010 2:42:00 AM
or staying along the lines of your original code:

     ActiveWindow.Close (False)
0
Utf
4/2/2010 2:55:01 AM
Reply:

Similar Artilces:

file will not save
One of my excel files will not save. it seems to work ok, but when i try to save it, i get a "document not saved" message. the file cannot be closed unless i agree not to try to save it. any ideas why i cannot save this file? #1. Are you working off a floppy? If yes, then don't do this. Use windows explorer to copy from floppy to harddrive and work from there (and save there). Then use windows explorer to copy back to floppy. #2. You're saving to a location that you don't have permission to save to. #3. Your diskdrive is out of space??? missionary wrote...

Missing File Day 3 No resolution ?
No. Is this file something that can be sent to me? -----Original Message----- From: "Diane Poremsky" <info@cdolive.com> Sent: 4/12/2004 8:15:04 PM Subject: Re: Missing file still.... did you have different versions or suites of office installed? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com "Kyle" <anonymous@discussions.microsoft.com> wrote in mess...

Slow VBA macro
Every time the following code runs and it reaches a blank cell it takes 2-3 seconds to update the cell with a zero: Do Until ActiveCell.Offset(1, -3) = "" ActiveCell.Offset(1, 0).Range("A1").Select Select Case ActiveCell Case Is = "" Selection.FormulaR1C1 = 0 End Select Loop I've tried Application.ScreenUpdating = False but the macro is still very slow. Any suggestions as to ho...

POS CLosing Balance
Is there anyway to edit the amount entered when you closed for the day? Occasionally I typo and I am off by a few dollars and I want to fix them so my books are right. Run an X Report to verify your balances before running your Z Report. You can edit Closing amounts after they have been entered - just go back to "Enter Closing Amounts" - RMS will warn you that amounts have already been entered, but it will allow you to overwrite them. Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.com ---------------------------------------------- Please DO NOT r...

Word Doc Macro help needed please!
I need to make a mocro that will work in a word doc. This macro would start with [000001] and count up one number each paragraph. For example paragraph two would auto show [000002] and so on. Any help would be GREAT! I have a word file which contains 100 pages. All the pages have name & address of companies.(not in table) i have to transfer them to excel in column format(for example first name, last name, address, phone etc) can any one tell me code for this( i know how to open word & creat new excel sheet) . I need code for how to reach to lines of word. r there any thing like &quo...

ProbleM: when I restore a mailbox using Exmerge with a pst file, nothing is transferred.
Hi, I am practising Exmerge for a big remote site migration in a couple of weeks. One thing I dont understand is that I can backup one test mailbox fine using Exmerge (I know this works, as I have opened the mailbox pst file within outlook and everything is there), but when I perform the restore using the pst file, nothing happens. There is no error messages, and Emerge goes through the motions (though it finishes supsiciously quick), but when I open the mailbox, no emails have been restored. Although it is great that Exmerge is working for the backup part of the stage, I am disappointed it i...

Importing ofx file
I'm using Money 2004 Premium and I was downloading my bank account information in ofx format directly in Money; recently this stopped working and I have to manually import the file into money. Not a big deal, but an annoyance just the same. Does anyone have a suggestion as to a fix for this? tia dennisd In message <QK3kl.3776$rt3.617@newsfe15.iad>, dennis <djd@home.net> writes >I'm using Money 2004 Premium and I was downloading my bank account >information in ofx format directly in Money; recently this stopped working >and I have to manually import the fi...

error when opening .accdb file
I don't think this is a new issue but I can't seem to find the resolution... I get an error when opening my Access 2007 formatted database stating that the file could not be found, though at the same time the file opens successfully. -- Error is intermittent. On occasions where the error does not occur, the file opens normally (I have never had an occasion where the file did not open at all) -- I have only seen the error happen when I have a 'Display Form' set in the Application Options for the 'Current Database' -- The database contains macros, VBA m...

Default Folder for PST files?
I have a slightly different question relating to the above: I already have my current & archive pst files stored in my own personal folders. When I want to open my archive folder I right-click Outlook Today & select 'Open Outlook Data File'. Everytime, Outlook defaults to its own path (Documents & Settings\User\Local Settings\Application Data\Microsoft\Outlook\) This is really annoying & I would like it to default to opening a customised path, such as C:\Mail\ Any suggestions? -- Cheers, James Goodman Hi James, if you want to displace your pst file, please ...

Last Closing Balance
Last Closing Balance should not be based on customer properties. Instead, it should be based on AR history from the last closing date to the end of the month, since it's already being done on the Account Info tab of customer properties. Thanks, Matt ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "...

Importing Contract from .csv file is not working
Hi, I m new to CRM. I have two column in my .CSV file. name and phone number i am trying to imort them to CRM contact Module. Everything happen smooth, i mean mapping of fields. But it does not Import the Contact in to CRM , instead the task goes and sits into the Buld Import Activity. And shows the Status as "Pending". I am using CRM Client and all the services are running..... Please let me know what could be the problem.. Labhesh Shrimali Bangalore - India MCP. Hi you have to change the Log on account for the Workflow Service on the CRM Server Regards, Dirk F ...

Enable macro #4
Is there a way that when a user opens an excel workbook that it will enable the macro without asking to disable or enable? I have users that click on disable, then the macro will not run. I have two macro buttons set up and they choose the one that is needed at this time. I would rather it open and the enable already be set without them having to click on it. Is this possible? No, Pam. Sorry. You can "force" them to enable. http://vbaexpress.com/kb/getarticle.php?kb_id=578 So, you could set it up that if they don't enable, they don't see... if they do enable, no...

Pointing to correct macro path using excel custom toolbar
I have created an excel 2000 template (.xlt) containing a number o macros. When I open copies of this template on various pcs, the macro function correctly, except I cannot successfully run the macros usin the custom toolbar I created, because (I think) within the toolbar th paths to the macros are pointed to the original location on my pc. An advice on how I can resolve this would be gratefully received -- Message posted from http://www.ExcelForum.com Have you thought about building the toolbar when the file opens? Or maybe separating the worksheet portion of the template from the code pa...

Hide row code help
I am using the following script to hide or unhide rows. How do I code the offset to only work when a row is being unhid. If we cant do this only offset when it is being hidden or unhidden? Thank you Private Sub Worksheet_Change(ByVal Target As Range) 'Application.EnableEvents = False' not necessary If Not Application.Intersect(Target, Range("B9")) Is Nothing Then Rows("10:11").Hidden = IIf(UCase(Range("B9")) = "", True, False) 'spelling ActiveCell.Offset(-6, 0).Select End If 'Application.EnableEvents = False ...

Macro for Internet Order Window
I want to create a macro to launch the CTL-SHIFT-F10 "Internet order" button (because I am going to make a custom button for it). However, I cannot record the macro because as soon as I hit CTRL-SHIFT-F10, the order popup window pops up and I cannot end the macro by doing SHIFT-F3. If I close the window, then hit SHIFT-F3 to end the macro, the macro just opens and then closes the internet order window. Is there another way to do it? Thanks, mickie No ideas? No one has done this? Mickie wrote: > I want to create a macro to launch the CTL-SHIFT-F10 "Int...

Changing of Cell protections after saving Excel File (2002)
This problem occurs when I protect a document using a macro 4.0 function: =PROTECT.DOCUMENT(TRUE,,,TRUE,TRUE). When I use the function within a macro4.0 macro, on an original file, everything works fine. The sheet has unlocked cells, and when the sheet is protected, it allows me to access those cells. But if I save the file, or save.as another name, then the fun begins. The enable selection of the sheet( view codes) has gone from 0-xlNoRestrictions to -4142- xlNoSelection. This locks me out of doing anything in the sheet. When I unprotect and then re-protect the sheet using the T...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Bad File Name
I'm getting the Error #52, Bad File Name or Number. FileCopy "C:\PROSERV\DB\Restore.mdb", "C:\PROSERV\BU\Format(Date,""yyyymmdd"") & "".mdb" The file defintely exisits. Could it be the format part thats not right. Thanks DS DS wrote: >I'm getting the Error #52, Bad File Name or Number. > >FileCopy "C:\PROSERV\DB\Restore.mdb", >"C:\PROSERV\BU\Format(Date,""yyyymmdd"") & "".mdb" Hard to tell without knowing what file name you are looking for. Is this the same ...

when starting excel, .doc & .dat file come up ?????
When I got my new computer at work XP Pro operating, w/2003 Office pro, every time I open Excel, about 12 .doc & .dat file pop up saying not excel format files, and I have to say close to everyone. Then, if automatically defaults to opening an excel file that is someone elses. I have tried running a repair, uninstalling and reinstalling, and nothing works. Never, have I had anything like this happen in my fifteen years. Any suggestions????? HELP it really slows me down. -- thankssomuch The first place I'd check is: Tools|Options|General Tab Make sure that the "at star...

Shared excel file dissapears
We use a shared excel 2000 xls file shared on a w2k server as a production log. we now have about 30 users with about 12 users constantly editing. As we add more users the dissapearances seem to mount up. we are at about 2 a day now. I was wondering what the max amount vs the recommended amount of simultaneous users are. Are there any known issues which would cause excel to mysteriously vanish?? thanks cr -- http://QLiner.com It has been said that democracy is the worst form of government except all the others that have been tried. - Winston Churchill ...

Publisher 2003 file not updated on save
Hi, I have a client using Publisher 2003 under XP. The file she is working on, March.pub, is stored on a Windows 2003 server which she accesses via a mapped P: drive. Yesterday, she worked on a file most of the day and swears she did a Save very often. About 4pm, she saved, printed her work, exited from Publisher, logged off Windows, and went home. Today when she came in she opened the file, only to find that it was missing much of her work. I checked and in fact the latest version on the server is from about 1pm. I had no luck finding a temporary version on the XP machine's C: dr...

I have a e-mail in my delete file that will not deleate.
I have tried to delete a file from my junk mail file, when I try to remove the e-mail I get a message to go to an in box repair tool, with a scanpst.exe. Nothing appears when I type in scanpst.exe and this e-mail I cannot move the e-mail it is frozen Search, to include hidden files for scanpst.exe. You dont run scanpst.exe from within outlook "roger" <roger@discussions.microsoft.com> wrote in message news:EBD25472-D780-4E95-9F7C-1F69E01FE913@microsoft.com... >I have tried to delete a file from my junk mail file, when I try to remove > the e-mail I get a m...

Macro syntax to open file in current explorer folder
Pt 1 : MS Excel 97 SR-2 ----------------------- I would like to use a macro code line starting Workbooks.OpenText FileName:=".\AmsAll-1.prn", _ to open the tab delimited file "AmsAll-1.prn" in the folder from which I launch the Excel application. However the ".\" path qualifier always reverts to the C: drive, not the K: mapped drive that I access all my project files from. It is inconvenient to navigate several levels down to the project from C:\ just to run this one application. The following does work : Workbooks.OpenText FileName:="k:.\AmsAll-1...

delimited file format issue
i get reports from (idx) a program that are delimited files. the columns are all fine but 1 and i can't figure it out. its supposed to be money and comes across as 11500. in the original program (idx) it would look like 115.00 and that is how i want it to look in excel. i tried the easy stuff like formatting and i keep getting 11500.00 or 1150.0 in my simple mind i thought it would be easy to move that decimal but its not turning out that way. i have thousands of line items so doing it one by one is not the optimum solution. any help is appreciated. excel 2003 os XP You really wa...

void sales batch to closed period
I have a batch that shows up in series post that cannot post, it always shows "needs edit" once we attempt to post it. How do I delete this unpostable sales batch? Thanks Randall Farris Randall, Why not edit the batch to fix the errors and then post it as normal. If it needs editing, there is an error in it somewhere that will not allow it to post. Lyle In article <OoI9VYRxFHA.1284@tk2msftngp13.phx.gbl>, rwfarris@gci.net says... > I have a batch that shows up in series post that cannot post, it always > shows "needs edit" once we attempt to post it. ...