Document Not Saved Error

Had this recuring problem that after doing some work my excel file came up with the error "document not saved". Just managed to fix it so i thought i'd share it here.

This solution may work for you if like me you have a userform (in vba) that uses a RefEdit control.

Open the file, but disable macros.

Delete the RefEdit control (unfortunately my fix is you do without it).

In vba go tools>references. You may have a reference that is prefixed MISSING. Uncheck the reference.

Save the file (with macros disabled you should be able to do this).

Go back in, this time enabling macros and you should not have the problem again

Free Excel Help Forum

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

Remove Personal Information from Excel Files
How to remove all personally identifiable information from an Excel file. When a file is created in Excel, it auto ...
Error bars in Charts in Excel
How to add, manage, and remove error bars in charts in Excel. Error bars allow you to show the potential variance ...
Export an Excel File to a CSV File
How to export an Excel file to a CSV file (comma separated values file).  This allows you to turn any Excel spread ...
Prevent Errors From Appearing in Excel
How to prevent errors from appearing in formulas in Excel. This is especially helpful for the Vlookup function. Sec ...

Helpful Excel Macros

Excel Macro to Save a Specific Worksheet as a New File
- This Excel Macro allows you to save a specific worksheet within the Excel Workbook to its own new file. You will be a
Complete Guide to Printing in Excel Macros - PrintOut Method in Excel
- This free Excel macro illustrates all of the possible parameters and arguments that you can include in the PrintOut Meth
Close a Workbook after a Time Limit is Reached
- This macro will automatically close the workbook in which it is located after that workbook has been opened for a certai
Open a Word Document from Excel
- This Microsoft Excel macro will open a Microsoft Word document from excel. With this macro, you can open any word docume
Save the Current Worksheet as a New Excel Workbook File
- This Excel Macro will save the currently visible/active worksheet (the one that you see when you run the macro) to a

Similar Topics

I created a spreadsheet for work that uses quite a bit of macros that I wrote in VBA.

Everything was running well, until I attempted to add a splashscreen, that launches a macro. The macro performs a web query on a small website, and if a cell range is valid, it continues running. If not valid, it closes the workbook.
I saved the file.

Now when I try to load the file, I get the following Error.

"Error in loading DLL"

I went to VBE and checked TOOLS>REFERENCES

and there is a MISSING: Ref Edit Control listed.
I try to uncheck the box and I get the error "Can't perform requested operation"

I'm at a complete Loss.

I have noticed that I can't pull up any of the Modules....

Any suggestions would be greatly appreciated!

I have a spreadsheet with a set of macros. One of the macros used the Microsoft Calendar Control 11 to furnish a popup calendar. However, I have disable this by erasing the page code which referenced the control.

I have given a copy of the spreadsheet to a coworker. Everything worked fine until she got Office 2010, at which point the macros quit working with the error message "Unable to find project or library." Using the VBA References dialog box, I have traced this issue to the fact that the Office 2010 installation on her computer does not have the Calendar Control 11 file. I went into the References dialog & tried to uncheck Microsoft Calendar Control 11, but I get an error message telling me it can't be deleted because it's in use. I've looked through my other macros & can find no references to it. The help box on the error message says to remove the control from the form & then uncheck the box. There are no forms listed in the project window.

Can someone tell me how to find where this may be so I can delete it? While we could just install the control file on her computer, I'd really prefer to clean up the spreadsheet so I don't keep running into this every time I provide a copy to someone.

Any help appreciated.

---GJ Case

Hello, if anyone has experience with Run-time error 1004 or LockXLS, maybe you could give me some guidance.

I have a fully-working spreadsheet which uses macros. One of the macros codes has a line to save the activeworkbook.
It works fine as an xlsm file.

However, when I use LockXLS protection software to protect the file, it turns it into an exe file.
This exe file always produces a Run-time error 1004: Document Not Saved
whenever I run a certain macro.
It produces the error right when the code tries to save the workbook.

Is this a common problem with LockXLS? Is there any solution?

Thanks for your help!

Had a workbook with macros developed in Excel 97. Loaded it into excel 2007. Works fine saved it in xlsm format. If I try to encrypt the file I get error message that basically says can't do it with old macros. I cannot find any reference on how to change macro sto be Excel2007 compatible. Is there one? So I saved the file in xls format. All is OK.

BUT, if I converted or rewrote the macros, I have read about another problem (and duplicated it). apparently you cannot open encrypted xlsm files with macros enabled. Can't find a way to override this. Found some reference to SP2. Thats what I have running. Found suggestions for registry change to disable virus scan of macros. Did not work.

I have an Excel sheet at work with macros attached to it. I saved the
worksheet as a different file name so I could make changes. Now anytime I try
to execute any of the macros in the original worksheet, it first opens the
file that I "saved as" before it'll execute the macro. I deleted the file
that I'd "saved as" and now it won't execute a macro at all. It gives me an
error message saying it can't find a specified file. I've checked over the VB
coding of the macros to see if Excel made reference to the new file that I'd
saved, but can't find it referenced anywhere in the code

I have been trying to write what I thought would be a simple macro to save a worksheet as a pdf file with a file path based on cell references. For some reason, I can't seem to get it to work and have tried everything I know to fix it.

The macro I wrote looks like this:

Public Sub Save_As_PDF_Test()

Dim Name As String
Dim Stamp As String
Dim WhereTo As String
Dim sFileName As String

WhereTo = ActiveCell.Value
Stamp = ActiveCell.Value
If Stamp = "" Then Stamp = Date

Name = ActiveCell.Value

sFileName = WhereTo & Name & "_" & Stamp & ".pdf"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sFileName, Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _

End Sub

When I run the macro, I get the following error message:

"Run time error '1004' Document not saved. Document may be open, or an error may be encountered when when saving."

The document has indeed been saved in .xlsm format and other macros appear to be running fine. The Error shown when running the debugger is in the next to last command to save to PDF ("ActiveSheet.ExportAsFixedFormat Type:.....")

I am running Excel 2010 in Windows 7 on a virtual machine using Parallels on a Mac. I have had not trouble with macros that save documents to a cell reference file path - the error appears isolated to the Save to PDF command.

I'm interested in any ideas how to get this working.


I have worked on a file for long time using Excel 2003. I have few macros and custom functions written. I decided to use another computer to do some additional work on this file - mainly new formulas and outline, but no code writing. The file was opened as 2003 and was saved in the same fashion, was not converted to 2007 at any point.

I saved it and closed it. I then opened it on my original computer and after opening it gave me "Automation Error - Catastrophic Failure" message without an error number. Right after that it sent me to VBA screen and instead of having my file name under the Project Tree, it has "VBAproject". I click on it and can see my code and my forms, but the worksheets are not label properly plus they have this little blue icon next to them.

I tried to open the file again by clicking Disable macros, and no error was given but obviously can't do much with the file. Now the option of Enable/Disable macros is not showing at all, which is very odd! Not only on this file.

One thing I read around is about sharing and references. This file sharing options were turned off so that's not it. I then realized under VBA-Tools-References that the office 2007 is referencing different files for some of the selections, like Visual Basic For Applications, Microsoft Excel 12.0 Object Library, etc. I copied those files to the proper folders on the 2003 computer but that didn't do the trick. The problem is that with my 2003 computer I can't check these references because the file crashes on opening and it restricts me from going to that option.

Any ideas? I did quite of work on this file so redoing this is the last resort but I hope I don't have to go that route.

Thank you in advance!

Hi everybody,

By mistake I named to different macros with the same name, saved the file and closed it.

Now I can't open the workbook. The file opens but it stays freezze and I can't anything.

I tried by opening the file disabeling the macros but this way I cant delete one of the macros.

How can I open this file and fix the problem?

Thank you everyone
Hugo Lopez

Here's a little public service (and a reference point for me the next
time this happens if I forget) for people stuck with this type of Excel

You try to save a file (for me, 53Mb excel file using extensive VBA and
autofiltering to an NTFS compressed network share) and get the
following type of message;

Your changes could not be saved to '<<filename>>.xls", but were
saved to a temporary document named 'D933D120'. Close the
existing document, then open the temporary document and
save it under a new name."

You attempt to save and get an error "File not saved".

You close, reboot, wait for a three-quarter moon etc etc, try to open
the temporary file and get the error
"Excel cannot access 'D933D120'. The document may be read-only or

Thank you to those authors describing the above as a garbage bucket
error message, commonly having nothing to do with either read-only
attributes or encryption, which got me thinking "what else could stop a
file being opened".

Here's the solution;
Right click the file

For me, the security settings were blank. It appears that the saving
process which creates this temp file when "overwriting" (actually
creates new file(the temp file above), deletes old, renames new with
old name) an old file fell over before it could apply the relevant
access lists and rename the file.

Simply add yourself as an authorised user for the file, with full

I was then able to open the file, rename etcetera, as described on the
original error message.

As to the original cause of the issue, ie why the save process fell
? - didn't get identical
messages, so not 100%

?Various mentions of antivirus software - unconfirmed

?NTFS compression - takes so long on some large files that a timeout of
some sort occurs- hypothetical only. May depend on network traffic at
the time.

I have a file that contains Macros that I want to share with others. The only problem I have is that users have the right to enable or disable macros. If they disable the macro - some of the security functions could be lost.

Is there a way to create a macro that will not allow the file to be opened if they choose to Disable the Macros.

Could this be done/Anyone have any suggestions?

I have an add-in which I manage. I have two "versions" of the add-in. One is the add-in saved as a workbook and the other is that same workbook, but just saved as an add-in file (".xlam").

I've recently been unable to run some buttons on the ribbon when I have just the add-in file (".xlam") open (and the workbook version closed). The error I get on certain macros is this:

"Cannot run macro 'YourMacro'. The macro may not be available in this workbook or all macros may be disabled."

I've checked and my macros are not disabled. And as I've said, other macros on the ribbon from this same add-in work, it's just a set of macros which seemingly have nothing in common that don't work.

I've found that if I rename the macros that I cannot run, they will work. So, even though the macro 'YourMacro' won't work, if I change the ribbon to call 'YourMacro2" and change the macro name to 'YourMacro2', then it works.

My hypothesis is that somehow Excel is pointing to the workbook version (".xlsm") of the add-in rather than the add-in version (".xlam"). And it's giving me an error since the workbook version is closed. When I have the workbook version open, all of the buttons work. But that's just my guess right now... and even if that's the actual problem, not sure how to fix it.

I have an excel file saved as macro-enabled that is perfectly functional and can be opened on my computer (via Security Warning - Enable Macros). The file is saved on another computer, through which I am accessing by a network.

This other computer is unable to run the macros, and when we open the file in excel there is no security warning that pops up (like there is on my computer). I have gone to the Excel Options and entered the trust center settings, and finally the Macro Settings. It is set at Disable all macros with notification. (same for both computers... but on one of the computers there is no security warning that pops up)

We tried enabling all macros (temporarily) and tried re-opening the file and running a macro. We got an error message saying that macros were not enabled.

We also made the file a trusted location and saw no changes.

Please Help!
Thank you!


I am using the 'Microsoft Forms 2.0 Multipage' control on a worksheet (not a userform). When I save any file and then re-open the file, I receive the error:

"This application is about to initialize ActiveX controls that might be unsafe. If you trust the source of this document, select Yes and the control will be initialized using your document setting."

I click Yes, and the control works as expected.

If I add the multipage control to a userform, save the file, and re-open the file, I do not receive the error.

The multipage control is being used on the worksheet as tabs for a report. When you click one of the tabs, it changes a value on another worksheet that will cause the charts/listboxes on the report to display different data.

I like using the multipage control over the tabstrip control, because I have had issues with when you place your cursor on a tabstrip, the tabs/buttons slightly move/expand (using the 'fmTabStyleButtons' style). This especially happens when you shrink the tabset control to show just the rows of the buttons. The MultiPage buttons do not shrink/move when you place your cursor over the button.

I would like this file to be able to be opened by other users and all they would need to do is click the 'Enable Macros' button.

Any help would be great!


i got a 3,43mb .xls file. i edited the file on excel2003 three days ago, and i saved it (i'm sure, and i've double checked it @ right click --> properties --> summary --> origin --> date last saved). now if i open the file, the file seems to open (excel opens too, but i simply cannot see the file. here's what happens:

excel opens, and starts to load the file (the process indicator on the status bar is visible) when it fully loads the file, i get a security notice (i last edited the file on a laptop) about enabling or disabling the macros regardless of whether i enable or disable the macros, the status bar states "Ready", but i only see excel's default background with all menu items greyed out (except new and open), so i can't really do anything. it's like an excel in itself without any file opened within. i get no other error messages. if i try to reopen the file, excel states that it is already open. i've tried opening the file in both excel2003 and excel2007 with similar results.

any ideas what i might try or do to be able to actually use my xls file again normally?


Hi everyone,

I have just installed Office 2007 Professional on my PC at work, and saved my Excel 2003 files as Macro-Enabled workbooks -- especially for the increased limits for conditional formatting.

When I open the file, macros are disabled and the Message Bar appears with the following: "Security Warning Macros are disabled." When I clicked Options on the Message Bar, the security dialog box that opens shows only "Help protect me from unknown content" with the radio button selected, but the "Enable this content" and "Trust all documents from this publisher" are not shown -- neither are they in the Trust Centre Settings.

Furthermore, when I click Developer tab, Design Mode is enabled, but I am unable to disable it.

Why is the option to enable macros not available, and how can I enable macros.

Thank you,

Apologies if this has been answered previously - I couldn't think of a search term that wouldn't bring up a large number of results!

This is a document I'm developing at work, so unfortunately I cannot upload it for people to test with. I could provide blanked out screenshots if required, but I hope this won't be necessary.

I have an Excel file (I'll refer to as the 'master file'), which I use to build up a report (consisting of rows of data). It has quite an extensive front panel which utilises a large number of macros. The master document is ~6 MB in size and has ~300 worksheets (most of which are back-end and xlveryhidden).

Colleagues will be using the master file to generate reports. They may want to send the data to other people, and so to assist with this, I have developed an import/export feature, which saves a new document which only contains the data (none of the macros, front panel, etc.). Not only does this mean that there is less risk of the master document getting into the wrong hands, but it also means that the file they send is significantly reduced in filesize (~200 KB rather than 6 MB), as it only contains the bare essentials.

So, that's a bit of the background, here comes the problem...

I have recently discovered an issue with the master file. When I import data using my own import feature, it opens the small Excel file that contains the data, copies the data into the master file, then closes the small Excel file. Once this has completed, however, the macros in my document run significantly slower (often 5-10 times slower than normal). Given that some of these macros take a few seconds to run at the best of times, this can be unbearably slow.

My first thought was that it was running slower because it was having to calculate the extra cells associated with the imported data, however, I found that if I removed all the data after importing, it would still run significantly slower than normal.

I have found one solution, but it is by no means ideal. If I import the data, save the master file with the data imported, close Excel, and re-open the master file, the macros run reasonably fast - not quite as fast as before the data is imported, but significantly faster than if I had imported and not saved/closed.

I tried searching online for a solution to this problem, but couldn't find anything concrete. Through my search, I read (here) that "Excel does not release all memory when workbooks are closed". Would I be right in thinking this is the likely cause of the slowdown in macro runtime? If it is, is there a possible solution that does not involve me having to save and close Excel then re-open the file?

A key reason for the import/export feature was so that the user doesn't have to save the data in the master file, so ideally I would like to avoid using this as a solution.

Any help would be greatly appreciated. If you need more information, please let me know!


I have a strange problem and I have no idea what's causing it.
I have written an application in Excel 2003 that is used by multiple users. The workbook is located on a network-share and everybody except me has read-only rights there.

Since last week a user opened the workbook and it gave run-time errors when starting up (not really good at error-trapping ). After investigating it was clear that the Treeview-control was missing from the main-form. The Treeview control (6.0) is essential for the application and needs to be there because it gets populated with data from a SQL database. I corrected the problem by adding the treeview control again and saved the file. Today the control was missing again !?!?!?!

Does anybody have a clue why it is possible that the treeview control is gone eventhough nobody is able to save the file?




I have a large file that I have been working on at work in Excel 2007 running on XP and for some reason it will no longer open. I think I may have hit something on the keyboard but I have no idea what.

It was working fine this morning and yesterday, but earlier this morning the screen went blue when I hit a key and I couldn't get it back. I exited Excel and tried to reopen the document. But now when I try to open it it comes up with a question about enabling/disabling macros and no matter what I click, or how I go in and edit my macro settings, it won't open. I just get a blank blue screen. Then when I close it, it asks me if I would like to save the changes to the file...but it didn't even open the file in the first place.

There are no macros in the file, I was going to create one yesterday but changed my mind halfway through and deleted it. In My Documents, the excel icon for the document has a yellow scroll with an exclamation mark on it. I'm not sure if this is something to do with the macro that the document thinks it has in it, or if it means the document is corrupt or something.

I have also tried restarting my computer, copying and then renaming the file and then trying to open that, and opening it in different ways (ie, from the recently opened list, from the actual file itself, etc). It's important I get this file back, I can't afford to have to start it again!

Any ideas? Thanks.


Every time I try to insert an ActiveX control (eg command button) from the control toolbox onto an Excel worksheet, I get the error "Cannot Insert Object". I've spent two hours searching the internet for a solution and nothing seems to help. I thought I may need to register an ocx file, but if so, I don't know what it's called. I tried registering the fm20.dll file, but I still get the error after doing that. Does anyone have any suggestions? This problem also prevents me from running macros in existing workbooks that have ActiveX controls, returning "unexpected error (32811)".


Hello All,

I recently created a system of macros (with the greatly appreciated help from this very board). Is there a way to apply the already-created macro to different excel files without the original file open?? I tried taking the original excel file which i used to create the macros and "saved as" a different file name and sure enough the macros didnt work (as I received a Debug error, alerting me the original file could not be found) but when I have the original file open along with the newly saved-as file the macro works... Any suggestions??

We recently upgraded a Novell 4.11 file server to Windows 2003. Now, at random, Windows NT 4, 95, and 98 clients that access large Excel spreadsheets get the dreaded "Document Not Saved" when attempting to save back.

I've read the Microsoft KB articles and I assure you that the problem is definately not a lack of disk capacity or a connectivity problem. Other applications stay running fine (at the same time), and most computers are connected via a port on a 100Mb VoIP phone. If connectivity were the issue, the phone would lose a connection.

I have attempted upgrading from Office 97 to Office 2000 with all service packs. I have attempted deleting all temporary files on both the local PC and the network server. I have attempted deleting and recreating new files. I have attempted copying the file to one system and back to the original location. When this problem happens, a "Save As" generally doesn't work afterwards - and due to heavy VBA macros and formatting, copying the data to a new spreadsheet is not a viable solution.

In addition, I'd be asking the guys to save to new locations and new files and new data literally 20-30 times a day. That's not an option.

What I need is for it to just "work". I need the guys to be able to hit "save" and have the document saved from where they opened it without jumping through hoops.

Sorry if I sound frustrated, I've been fighting this issue for about 6 months.

I am in charge of reviewing changes in our company's shipping schedule, and I will frequently get updated information that has maybe 100 columns and any number of rows. I never know what the column headers are going to be. Currently, I have to copy all of the volume information by hand into another worksheet, which is rather tedious. I am trying to make a program that will do all of this for me, and I'm stuck on this one point.

I have made a userform (UserForm1) that allows me to pick the range of data using a RefEdit control. Ideally, I would like to use the userform to pick only the column headers and have my program copy all of the data (minus the column header) in those columns into my other worksheet.

If I have in my RefEdit control a cell reference of 'Sheet1'!$R$2:$Z$2, how can I reference just the column information so that I can copy all of my data?

Thanks in advance

I have stumped myself again and thought maybe someone would have an "Ohhh yeah, duhh!!!" idea to help me out ...

Basically, I want the excel spreadsheet to "BE Protected" in standard form, and only be "Unprotected" when macros are enabled -- BUT DONT JUMP TO CONCLUSIONS, hear me out, it gets deeper than that ....

If the user does not enable macros, I want the book to be protected. If they do enable macros, it becomes unprotected.... (On load is good enough, no need to be real-time)..... But, they can save the book, so it would no longer be protected , which is where my question comes in ...

I could use the -unprotect "password"- on load when macros are enabled but this will only work if the spreadsheet was originally protected and is never saved again. This is a problem because this workbook will be given to others and will be saved time and time again.

So, I had a vision :-) .... function 'before save' , protect the sheet using -protect "password"- , allow the sheet to save, and then unprotect back using 'unprotect "password"' so you can continue using - BUT, the problem with this is now I have created an endless loop in theory, because after it unprotects it would want to re-save again because it changed ....

So, is there anything else I could do to accomplish this ?
(Protect workbook in excel only, unprotect workbook when macros are enable, and allow changes to be saved..)

Thanks !

Is it possible to share a workbook with macros and have the macros work properly. I have one spreadsheet that needs to be shared by many users. We want to all be in the same document at the same time saving changes. The real catch is that the workbook has macros. I used the 'Share Workbook' function under tools. At the end of the setup, it told me that the macros would not work properly. The odd thing is that everytime I try to click on one of the macros I get an error, but yet the macro still performs the function. So essentially the macro works, it is just a pain because you have to click 'end' everytime on the error screen. Any suggestions?



Hello everyone,
I have a weird problem. I have had these workbooks set up for months, and they have about a dozen or so sheets in there. On these sheets I am doing tons of v and h lookups, so I name the ranges to make it easier to decipher.

However, just recently whenever I open the file nothing works; I go to the name manager and, for example, for the named range "rankings" it will point to "=[Rankings]#REF!$D$2:$D$33

So I go and delete all these values, reset them, save it, close, open, and the reference errors are back! No reason that I can see... any advice?

I don't have any macros programmed in, and it's being saved as an .xlsx.

This error also occurs no matter if I save the file to the hard drive, network drive, or a USB key.