![]() |
#1
|
|||
|
|||
![]()
I have an add-in for processing batch files in a selected folder. One of the built-in batch processes converts older .doc and .dot format files as .docx, .docm, .dotx or .dotm as appropriate.
It basically just opens the file and saves it in a new format then deletes the old .doc or .dot file. It works fine with Word 2010-2019. And it "almost" works with Word 2007. However, it won't delete the old file. It errors on the Kill statement below with RTE 70. Permission Denied (other attempts e.g., FileSystemObject also result in RTE 70). Code:
Case "Convert older format documents" strTempName = oDoc.FullName If Right(LCase(oDoc.Name), 3) = "dot" Then mod_Convert.ConvertFiles oDoc, oDoc.Path, True Else mod_Convert.ConvertFiles oDoc, oDoc.Path, False End If If .optActiveDocument Then If .chkMatchWildCards.Value = True Then strNewName = oDoc.FullName oDoc.Close 0 DoEvents Kill strTempName Documents.Open strNewName End If Else oDoc.Close 0 DoEvents If .chkMatchWildCards.Value = True Then Kill strTempName End If The file is not open but Windows seems to think it is. If I close Word and then reopen Word, I can then delete the file with a simple Kill statement. I have tried: SetAttr strTempName, vbNormal Does anyone know how to force Windows to "rethink" the state of a file that is not opened and allow the Kill to proceed without error? Thanks. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Villalobos | Word VBA | 9 | 07-06-2017 09:50 PM |
Odd errors | cyberslugg | PowerPoint | 2 | 02-23-2016 01:26 PM |
![]() |
PosseJohn | Word VBA | 1 | 12-09-2013 03:32 PM |
"One or more margins are set outside the printable area of the page." How to kill? | WaltR | Word | 4 | 07-16-2012 01:55 PM |
![]() |
Finn O'Deirg | Word | 2 | 07-03-2012 01:54 PM |