2

The following code runs just fine when ActiveWorkbook.path is equal to a Windows path explorer path like:

**C:\User\John**

But gives an error of "Run-Tie Error 53 - File Not Found" on the line Kill() when ActiveWorkbook.path is equal to a SharePoint path like:

**https://mycompany.sharepoint.com/sites/acctsdept**

How can i fix this code to accept a web/sharepoint path?

Here is the current code:

flnameM = ActiveWorkbook.Path + "\" + folder + "\" + ManualFile
If Len(flnameM) <> 0 Then
    reply = MsgBox("File - " + flnameM + " already exists. Replace?", vbOKCancel)
    If reply = vbCancel Then
        End
    Else
        Kill (flnameM)
    End If
End If

enter image description here

braX
  • 11,506
  • 5
  • 20
  • 33
KD_Raj
  • 189
  • 3
  • 16
  • 2
    Kill works only on files on your hard drive, not files on the internet. – braX Jul 17 '22 at 18:38
  • Also, check https://stackoverflow.com/questions/71141565/excel-vba-delete-file-from-sharepoint-bypassing-confirmation and https://stackoverflow.com/questions/69541581/deleting-a-file-from-sharepoint-using-vba – Foxfire And Burns And Burns Jul 18 '22 at 11:07

0 Answers0