Excel saving Buttons

0

I am working on a document in excel, i have 2 buttons on the main 1st sheet. The main button saves the whole document the when i resave the document future weeks it asks which week i want to save which is fine that works. How ever i have created a 2 button but i am wanting this button just to save certain sheets i have got the macro to the button working however when i test the sheet by clicking the button to over save a previous weeks work i get the below message. The file is created as the original document is saved there, so how to i get to to save?

Answer
Discuss

Discussion

You're going to have to edit your question and re-post the error message. You cannot upload photos with the question.
don (rep: 1247) Dec 12, '17 at 7:15 am
Add to Discussion

Answers

0

The process is to first create a document and then save it. This isn't as simple as it sounds because while you are creating a new document the original is still open. Your problem results from an apparent lack of precision your code applies to naming.

  1. Make sure that your code assigns the original workbook to a named object variable. Avoid working with 'ActiveWorkbook'. Give it a meaningful variable name.
  2. When you create a new workbook as a copy from the original, make sure that you assign it to a named object variable. Again, avoid working with 'ActiveWorkbook' as much as possible because Excel will change the 'active' workbook as you create new ones.
  3. Create variables for both the path and file name of the new workbook.
  4. Then save the new workbook and, unless you still need it, close it.

You can now repeat the above steps to create another new workbook.

Even if you didn't close the new workbook you still have two open workbooks at this moment, each with its own name, both saved in their own place, and you can manipulate either one using its variable name.

Discuss

Answer the Question

You must create an account to use the forum. Create an Account or Login