changin file name/location or deleting file

I heart Excel

Board Regular
Joined
Feb 28, 2011
Messages
66
Hello,

I have created a Sickness Form that is filled out by our office PA. She partially fills out the form and clicks on the 'Saves As' button, this saves the form to another location and changes the name to the staff members name (located in a specific cell).

She then continuously accesses the form and once completed clicks on the 'Submit' button, which prints the form to our internal image storage system.

There is a couple of things I am having problems trying to acheive, which I want to run behind the scenes when the Submit button is selected...
  • I need the file name to change, just before the print, back to Sickness Form, this is to ensure the script works for the printing to our internal system.
  • Once Printed the form then needs to either move location (into a file for me to delete at a later date) or delete!
Many thanks in advance :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
From reading your post, I think that the command "Name ... As ..." does what you need. Can you check it out in the documentation please?
 
Upvote 0
The "Submit" button should begin by doing what "SaveAs" does, except it should save the file as "Sickness Form" rather than the staff member's name.

Alternately, the "SaveAs" button should do two saves, once as the staff member's name, and again as "Sickness Form".
 
Upvote 0
I have spoken to the guys who deal with the scripts and they have told me that they can amend their system to read the script no matter what file name!!

So this is sorted... HOWEVER!! I really want the file to Submit and then delete! Is there anyway I can Kill Active.Workbook on Close?

I have seen that I can run Kill on the file once it is closed, but two things which this don't seem to work for me -

1. The file name varies everytime depending on what it has 'saved as' originally.
2. Where/How do I go about getting the Kill function to work on the file once it has closed?

Thanks :)
 
Upvote 0
Does the code reside in another file? Because when the file to be deleted, is closed, VBA-code will not run anymore.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,718
Members
452,939
Latest member
WCrawford

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