Save with Commandbox

Jannik

New Member
Joined
Jun 3, 2013
Messages
4
hello,


I would like to save individual worksheets.


I have 6 worksheets.


In 4 of them do if the CommandBox Save is clicked, the Save as window will open and the leaf should then be saved under the name of the field is in G10.


urgently need this VBA code


hopefully you can help me


Jannik
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I don't get it, sorry.

What do you mean by 'save individual worksheets'? Do you mean as a seperate workbook, for each worksheet?

What is the CommandBox?

What is a leaf?
 
Upvote 0
sorry my english is not so good :biggrin:

i think it is called Commandbox...

its a box like her when you click reply to thread.

I want to save invoices.

but i have two in Euro and two in Dollar with different prices.

by klicking this "CommandBox" it should be open the Save as window and it have to save as a seperat workbook, a completly new file.

The name of the file should be that number what is in the cell "G10"

i hope it is better explaint

best regards Jannik
 
Upvote 0
Jannik

Do you want to save each sheet in the workbook to a new workbook?

Or do you want to save some worksheets (invoices?) to a new workbook and some other worksheets(invoices?) to another workbook?

For example do you want to save the Euro worksheets/invoices to a new workbook?
 
Upvote 0
hello,

if the EUro invoice is complete, i want to save it as a new file.

So I would always open the same file. And then when I press Save, the invoice should be stored in a new file.
 
Upvote 0
How do you know if it's complete?

Is there a cell that can be checked for that?

To save a single sheet, without the SaveAs dialogue, to a new workbook this is what the code would look something like this
Code:
Dim wbNewInvoice As Workbook
Dim strFileName As String

   With Worksheets("EuroInvoice")
       strFilename = .Range("G10")
       .Copy
       Set wbNewInvoice = ActiveWorkbook

       wbNewInvoice.SaveAs ThisWorkbook.Path & "\" & strFilename & ".xlsx"
       wbNewInvoice.Close ' optional
   End With

This wil save the sheet 'EuroInvoice' in the same folder as the original workbook.

You would probably need to change sheet name, path etc.
 
Upvote 0
if i clock the Commandbox with Save i know it is complete.

I cant do it with the normal saving because i dont want to save the hole file, only the worksheet
 
Upvote 0
The code I posted will only save one worksheet, EuroInvoice.

You could run it from the click event of your command button.
 
Upvote 0

Forum statistics

Threads
1,215,572
Messages
6,125,605
Members
449,238
Latest member
wcbyers

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