MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Last one for today. Macro for moving a file.


Posted by Mike on November 12, 2001 1:07 PM

Sorry for such novice questions. Just learning.

When I complete a spreadsheet, it gets moved to a "Closed" folder from the "Open" quote folder.

Need a Simple macro for moving a file from one folder to another. I really would like to SaveAs to the new folder and delete the file in the Open Folder. Is that possible.

I think it's time to pick up an EXCEL MACRO programming book. :-)

Thanks,
Mike


Posted by faster on November 12, 2001 1:36 PM


This may do it. Test it on a few copies of your
work first.

Sub SaveDelete()
'change YOURPATH to the path you need to save the new book in

Dim ThisBook
ThisBook = ActiveWorkbook.FullName

Application.Dialogs(xlDialogSaveAs).Show "C:\YOURPATH\" & ActiveWorkbook.Name

If MsgBox("Delete " & ThisBook, vbYesNo) = vbNo Then
Exit Sub
End If

Kill ThisBook

End Sub