We help IT Professionals succeed at work.
Get Started

Macro to delete and replace Excel file

487 Views
Last Modified: 2012-07-12
Hi guys,

I have an update button on a userform. When the user clicks this button it opens another workbook called update.xlsm. Once the update.xlsm opens, I have a macro in that workbook that closes the original workbook. This works great. Now I am trying to figure out, how I can add to the macro to delete the previous closed workbook, and replace that file with a fresh copy of the workbook stored on our network drive. Once the file is copied I want it to open and then close the update.xlsm workbook.

I am not sure how the macro will determine where the file to be deleted is located. Users save the file to any location they choose. When they click update, that file should be replaced regardless of location.

Any help on this will be greatly appreciated.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 25 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE