Resolved error when updating the local MSOffice add-in from the network

I am trying to write a procedure in PowerPoint 2003 that will automatically update the installed add-in. The overall process is as follows:

  • Remove add-in

    For Each objAddIn In Application.AddIns
        If UCase(objAddIn.Name) = UCase(AddInName) Then
            With objAddIn
                .Registered = msoFalse
                .AutoLoad = msoFalse
                .Loaded = msoFalse
            End With
        End If
    Next
  • Delete the file from the local add-ons directory

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(FileName) Then Set objFSO = Nothing Kill FileName End If
  • Copy file from network location

  • Install updated add-in

After reaching step 2, any attempt to delete a file after deleting using either FileSystemObject or a direct one Killinevitably creates Run-time error '70': Permission denied. If I remove Debug and then play, it runs as if there was never a problem.

Side note: I understand that I can use FSO to overwrite a local file, but this gives me the same error at runtime.

, , , "" , .

- , ?

+3
2

Addins, . , End With:

Application.AddIns.Remove objAddIn.Name
+1

KB, VBA, . http://support.microsoft.com/kb/209189

, VBA, , , , .

...

Kill Filename

If FileLocked(Filename) = True Then  
SetAttr Filename, vbNormal  
Kill Filename  
End If

* FileLocked - , KB209189
** , , Kill Win32 , (, , ).: D

0

Source: https://habr.com/ru/post/1757854/


All Articles