VBA move file

dlrollings83

New Member
Joined
Jul 7, 2016
Messages
18
Hi

I have no idea where to start on this. I have a file with a command button that when used saves the file as per the details in cell D2 and fires off an email for the spreadsheet to be complete. This then stores the file in C:\Checklists

I want to create another command button that when the document is complete, the file is moved from its current location as above to C:\Completed Checklists

Currently the second command button is to save as to this location and the sheet has to be manually deleted from its original location.

Is there anyway to have a VBA to move the active sheet/workbook (there is only 1 sheet on the workbook) and delete the original?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have tried to following but it does not kill the original file.

I get a message stating Compile Error: Named Argument not found

Private Sub CommandButton2_Click()

Dim FName As String
Dim FPath As String

FPath = "P:\Income Public\Universal credit\Checklists for Completion"
FName = Sheets("UC Checklist").Range("D2").Text
Kill Filename:=FPath & "" & FName

FPath = "H:\Documotive Scans"
FName = Sheets("UC Checklist").Range("D2").Text & "Completed"
ThisWorkbook.SaveAs Filename:=FPath & "" & FName

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
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