none
Microsoft word 2007 (randomly) creates a Temporary file and a empty doc file which contains no data, while using saveas in VBA.

    Question

  • We are facing a weird problem with one of our clients, they use a terminal connection to login on a terminal server and work like that. The problem lies with microsoft word 2007 when using the save as option (we use it programmaticly in vba), it sometimes creates a XXXXXXX.tmp file and not the filename we had chosen, although the filename is generated (touched) but is 0 kb. so with an example suppose we save the document as "Test.doc"  using document.saveas, sometimes the file test.doc is generated however sometimes we get a file like A3F59BE.tmp which contains the actual word document and "test.doc" which is an empty file.  So it's not the general temp files like ~test.doc or $test.doc which word usually creates.  Also worth noting we are saveing this file to a network share. I'm not certain how this is possible since it doensn't happen every time, it seems to happen randomly, and we can't wrap our heads around it. We have tried / checked numerous things like for example the rights on the folder where the documents are being saved, it happens also when we are logged in as an administrator who has full control on that map so we think it's not a rights problems. We also disabled autorepair features of microsoft word 2007, removed the normal dot(x) file so it gets regenerated the next time word started but it keeps happening randomly

    It almost seems like word 2007 is first creating a temp file of the actual document and then tries to copy this temp file to the real correctly named file but somehow fails from time to time. We tried using process monitor to get any wiser, however it never happend during the testing while process monitor was running, process monitor also slowed the saving of the file and terminal session itself a bit down so we couldn't see what was going on while these files were being created and what the possible errors might have been when it created the temp + empty doc file.

    It's also worth nothing that when it happens and when we rename this generated XXXXX.TMP to XXXXX.doc, microsoft word can open it and our changes and the contents of the document are all intact. We are really clueless as to what might be the cause.

    Also the microsoft office suite is fully updated.

    Has anyone ever faced this problem ? We googled around quite a bit but most of the time we only find problems regarding the normal temporary files starting with the tilde or dollar sign.

    Wednesday, June 09, 2010 2:47 PM

Answers

  • Dear Tim,

     

    First, I would like to explain that when we click Save on the File menu, the following happens:

    1.       Word builds a new temporary file using the edited version of the document.

    2.       After Word creates the temporary file, Word deletes the previous version of the document.

    3.       Word renames the temporary file to the same name as the previous version of the document.

     

    Text Pasted Between Files (Same Directory as Source File):

    When Word copies and pastes between documents, it may create a temporary file in the same directory as the source file. This is especially true if the source file is saved or closed. The temporary file represents the information that was referenced by the Clipboard prior to saving the file. Word creates this temporary file by renaming the old copy of the file to a temporary file name.

     

    Based on the current situation, the issue may occur when some problem occurs during the three steps. At this time, I suggest trying to test this issue by starting Word using the default settings, to see if this issue is caused by the corrupted Word global template.

     

    Start Word 2010 using default settings

    =====================

    In Windows Vista and Windows 7

    1. Exit Word 2010
    1. Click Start
    2. In the Start Search box, type the following text, and then press ENTER:
      "%programfiles%\microsoft office\office14\winword.exe" /a

     

    In Windows XP

    1. Exit Word 2010
    1. Click Start, and then click Run.
    2. In the Open box, type the following text, and then press ENTER:
      "%programfiles%\microsoft office\office14\winword.exe" /a

     

    Then, check again if the problem occurs. If the problem does not occur at this time, we can try to change the global template of Word. For the detailed steps on how to rename the global template, you can refer to this Microsoft Knowledge base article:

     

    How to troubleshoot problems that occur when you start or use Word 2010, Word 2007, Word 2003, or Word 2002

    http://support.microsoft.com/kb/921541

     

    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything I can do for you, please feel free to let me know.

     

    At the same time, as this issue is also related to VBA, I also suggest you posting this thread in the VSTO forum to see if there is any feedback from their side. For your convenience, I would like to list the VSTO forum link below:

    http://social.msdn.microsoft.com/Forums/en/vsto/threads

     

    Sally Tang

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  

     

    • Marked as answer by Sally Tang Wednesday, June 16, 2010 2:19 AM
    Thursday, June 10, 2010 8:16 AM

All replies

  • Dear Tim,

     

    First, I would like to explain that when we click Save on the File menu, the following happens:

    1.       Word builds a new temporary file using the edited version of the document.

    2.       After Word creates the temporary file, Word deletes the previous version of the document.

    3.       Word renames the temporary file to the same name as the previous version of the document.

     

    Text Pasted Between Files (Same Directory as Source File):

    When Word copies and pastes between documents, it may create a temporary file in the same directory as the source file. This is especially true if the source file is saved or closed. The temporary file represents the information that was referenced by the Clipboard prior to saving the file. Word creates this temporary file by renaming the old copy of the file to a temporary file name.

     

    Based on the current situation, the issue may occur when some problem occurs during the three steps. At this time, I suggest trying to test this issue by starting Word using the default settings, to see if this issue is caused by the corrupted Word global template.

     

    Start Word 2010 using default settings

    =====================

    In Windows Vista and Windows 7

    1. Exit Word 2010
    1. Click Start
    2. In the Start Search box, type the following text, and then press ENTER:
      "%programfiles%\microsoft office\office14\winword.exe" /a

     

    In Windows XP

    1. Exit Word 2010
    1. Click Start, and then click Run.
    2. In the Open box, type the following text, and then press ENTER:
      "%programfiles%\microsoft office\office14\winword.exe" /a

     

    Then, check again if the problem occurs. If the problem does not occur at this time, we can try to change the global template of Word. For the detailed steps on how to rename the global template, you can refer to this Microsoft Knowledge base article:

     

    How to troubleshoot problems that occur when you start or use Word 2010, Word 2007, Word 2003, or Word 2002

    http://support.microsoft.com/kb/921541

     

    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything I can do for you, please feel free to let me know.

     

    At the same time, as this issue is also related to VBA, I also suggest you posting this thread in the VSTO forum to see if there is any feedback from their side. For your convenience, I would like to list the VSTO forum link below:

    http://social.msdn.microsoft.com/Forums/en/vsto/threads

     

    Sally Tang

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  

     

    • Marked as answer by Sally Tang Wednesday, June 16, 2010 2:19 AM
    Thursday, June 10, 2010 8:16 AM
  • Hi,

     

    I am writing to see how everything is going with this issue. Is the problem resolved? If there is anything I can do for you, please feel free to let me know.

     

    Sally Tang

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  

     

    Monday, June 14, 2010 8:51 AM
  • Hi,

     

    As I have not heard from you for several days. I will go ahead and close this thread. If this issue is not resolved or you have any questions, please feel free to reply to us and this thread will be re-opened.

     

    Best Regards,

     

    Sally Tang

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  

    Wednesday, June 16, 2010 2:19 AM
  • We experience the same problem exactly as Tim describes it with a self-developed document management system.

    We have a few hundred customers, some thousand users in total, and occasionally word files get lost in the process. When we investigate it is always the case as you describe, the original file name is missing but the contents can be retrieved from a  xxxxxxxx.tmp file. In fact just rename the tmp file to it's original file name and problem solved.

    We always use VBA .saveas method, also when saving the document to itself, because we have experienced some problems with the .save command regarding maintaining some document properties. These temp files are only produced by Word 2007 and 2010. And like yourself we have not been able to find any info regarding these temp files on the net.

    The situation with a file gone missing is very seldom, but we notice that word leaves behind a lot of temp files of this type in our users' document directories. Which indicates to me that something goes wrong in word's handling of these files "quite" often even if the catastrophic outcome is more seldom.

    We have tried to make a test program in VBA, open and saveas two different files in sequence in a tight loop. This produces temp files but we never experienced loss of the original file name. I think maybe a slow network connection may induce the problem.

    Appreciate any new information you may have regarding this.

    Svein


    Wednesday, December 07, 2011 12:34 PM
  • very similar issue only the workstation is working on the file and saving from and to a local disk. Our version of MS Word is from Office 2010 professional. This randomly occurs when saving the large file (74MB) 115 pages as a docx. it sometimes creates a ~Wxxxxx.tmp file and not the filename chosen, although a saved copy of the filename is created but it is 0 kb.
    Thursday, March 29, 2012 7:49 PM