Kill Function will not delete the file

lnagel

Board Regular
Joined
May 28, 2018
Messages
117
Looks fairly simple - Code runs just like it knows what to do and then nothing

File resides on Desktop and .Fullname does return the correct path

Code:
tempFileName = targetWorkbook.FullName
    'MsgBox "Target Workbook Name = " & tempFileName
    targetWorkbook.Save
    targetWorkbook.Close
    Kill tempFileName

I have also tried to close the workbook using the workbooks.close method - same results

Ideas?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Spot ON! - I had a "SaveAs" that needed to be a "SaveCopyAs".... One of those couldnt see the forest cuz of the trees conundrums. Thanks so much RoryA
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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