Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetPersistent owner file ~$ in Word 2003

  • Samstag, 11. Juli 2009 20:16jfl4066 TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    I have a VBA application that will iterate thru a folder of Word docs and edit them. It will save them in a subfolder called "Temp". When I run a second iteration thru the "Temp" folder of files it stops because it encounters  an owner file beginning with ~$ . The owner file is always of the last edited file. How can I close this file or change the code to not even attempt to open it? Thanks for the help. PS. The files are opened and saved on a network drive.

Antworten

  • Sonntag, 12. Juli 2009 02:06ShasurMVPTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet

    These temp files get created when a document is opened (mostly when the document contains images, tables etc) and get automatically closed. At times they persist and are a nemesis

    One possible option is to tweak the loop that gets  the word document. You can check for the file name, and skip the file and proceed to the next one.

    If the file is already open then you can try

    If InStr(1, ActiveDocument.Name, "~$") Then
        ActiveDocument.Close False
    End If



    Cheers
    Shasur


    http://www.vbadud.blogspot.com
    • Als Antwort markiertjfl4066 Sonntag, 12. Juli 2009 02:47
    •  

Alle Antworten

  • Sonntag, 12. Juli 2009 02:06ShasurMVPTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet

    These temp files get created when a document is opened (mostly when the document contains images, tables etc) and get automatically closed. At times they persist and are a nemesis

    One possible option is to tweak the loop that gets  the word document. You can check for the file name, and skip the file and proceed to the next one.

    If the file is already open then you can try

    If InStr(1, ActiveDocument.Name, "~$") Then
        ActiveDocument.Close False
    End If



    Cheers
    Shasur


    http://www.vbadud.blogspot.com
    • Als Antwort markiertjfl4066 Sonntag, 12. Juli 2009 02:47
    •  
  • Sonntag, 12. Juli 2009 02:51jfl4066 TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    Thanks Shasur. I thought I wasn't doing something right when closing the file. It is strange
    because in some editing sessions it will not appear.