Deleting a file in SharePoint

tasander

Board Regular
Joined
Mar 6, 2009
Messages
67
Hello

I have a macro which pushes out the current excel workbook that I am in to various different SharePoint sites. I would like to be able to delete the previous version of the file. I have the name of the previous file stored in a variable called 'OldFileName'. I check that the file exists by seeing if it will open and it does so that isn't the issue.

I have tried the 2 different options but everytime I get the message "Run time error 53: File not found.

.DeleteFile OldFileName
kill OldFileName

Can anyone help? if this isn't possible then can I move these files into a different folder at least?

Many Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi Kevin

Yes it does and I have checked it is correct by opening the file up.

Do I need to have any specific references enabled for this to work?

Thanks
 
Upvote 0
I hadn't even realised that document repositories are actually also lists. I had a look at the link you sent me and am struggling to understand it plus vb doesn't seem to like the code that they offer even before i get to personalise it to my task.
 
Upvote 0

Forum statistics

Threads
1,215,548
Messages
6,125,468
Members
449,230
Latest member
ASBeard

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