Delete a workbook...

B

bramnizzle

I have a spreadsheet that a user fills out. We'll call it GAB.
1030.xls. The user fills out some fields and clicks a button "Save &
Send". This workbook is then copied and sent to another user. The
new user opens GAB.1030.xls and gets some information. The button now
reads "Done & Delete". When clicked, I want line B1 to be copied to
an archive workbook (called "archive.xls") and then I want GAB.
1030.xls to be deleted. I know that I can just copy B1 and stick it
in an email to this person, but that's not what my company wants.

I'm thinking when archive.xls is opened to paste line B1, that GAB.
1030.xls could be closed and then archive.xls could have the macro to
delete GAB.1030.xls??

Any ideas?

Oh, and I just wanted to say that I really appreciate all the advice I
get from this group. You all have saved my @$$ on more than one
occasion - big props!
 
R

Ron de Bruin

Hi

You can use code like this to copy to archive.xls in GAB.1030.xls
http://www.rondebruin.nl/copy1.htm
(See "What if the Database sheet is in another workbook")

Then you can use this to delete file in the same macro

With ThisWorkbook
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top