Unable to delete Sharepoint Excel file using Kill Command

alibini

New Member
Joined
Mar 15, 2020
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hi, and sorry for the basic question.

I am trying to delete a file in a sharepoint folder.

VBA.Kill ActieveWorkbook.Parth & "/*TEMP*.*"

continues to return the error:

Run-time error '53'. File not found.

The files is 100% there so don't understand why it doesn't find it.

If I replace *TEMP*.* with the exact filename and correct extension i get the same error message.

Any help much appreciated.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
It looks like a typo.
Rich (BB code):
VBA.Kill ActieveWorkbook.Path & "/*TEMP*.*"
 
Upvote 0
Sorry Cubist, was a typo above but not in my actual code so that's not the issue.
VBA.Kill ActieveWorkbook.Path & "/*TEMP*.*" produces the same error.
 
Upvote 0
have you “synced” the sharepoint folder?

Run this and see what happens. This should return the https path, which will not be accepted by "kill"

VBA Code:
debug.print activeworkbook.path
 
Upvote 0
have you “synced” the sharepoint folder?

Run this and see what happens. This should return the https path, which will not be accepted by "kill"

VBA Code:
debug.print activeworkbook.path
I would say NO. I'm not sure what that means or how to do it.
 
Upvote 0
I would say NO. I'm not sure what that means or how to do it.
correct. it returns the https filepath.

if i try to kill using the filepath in the file explorer address eg "C:\Folder\Next Folder etc\filename.xlsm" it still gives me the same error
 
Upvote 0
But can you find the file in a directory in your explorer? If so, do you have all rights in that folder?

Run this, select your file and see which filepath is being returned

VBA Code:
Sub jec()
 With Application.FileDialog(msoFileDialogFilePicker)
   If .Show Then Debug.Print .SelectedItems(1)
 End With
End Sub
 
Upvote 0
But can you find the file in a directory in your explorer? If so, do you have all rights in that folder?

Run this, select your file and see which filepath is being returned

VBA Code:
Sub jec()
 With Application.FileDialog(msoFileDialogFilePicker)
   If .Show Then Debug.Print .SelectedItems(1)
 End With
End Sub
i just discovered the C:\ file path did in fact delete the file. but the folder had not refreshed. when i manually refreshed the folder it was gone. i feel a bit silly now :(
 
Upvote 0
i just discovered the C:\ file path did in fact delete the file. but the folder had not refreshed. when i manually refreshed the folder it was gone. i feel a bit silly now :(
i mean the file was gone
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top