ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Create buttom that saves current file in a given filename (Excel) (https://www.excelbanter.com/excel-worksheet-functions/77970-create-buttom-saves-current-file-given-filename-excel.html)

mamealemka

Create buttom that saves current file in a given filename (Excel)
 
I want the user to save a protected worksheet by clicking on an action
buttom. The file should be saved with another file name taken from a cell in
the worksheet.



Thunder

Create buttom that saves current file in a given filename (Excel)
 

"mamealemka" ha scritto nel messaggio
...
I want the user to save a protected worksheet by clicking on an action
buttom. The file should be saved with another file name taken from a cell
in
the worksheet.


Hi,

try the following code:

Private Sub CommandButton1_Click()
Const MyPath = "C:\"

With ThisWorkbook
.SaveAs Filename:=MyPath & Cells(1, 2).Value & ".xls" '<===Cell B1 =
Change
End With

End Sub

This code does not make a control on the path of your folder.

Thunder



mamealemka

Create buttom that saves current file in a given filename (Exc
 
Hi Thunder

Thanks.

"Thunder" wrote:


"mamealemka" ha scritto nel messaggio
...
I want the user to save a protected worksheet by clicking on an action
buttom. The file should be saved with another file name taken from a cell
in
the worksheet.


Hi,

try the following code:

Private Sub CommandButton1_Click()
Const MyPath = "C:\"

With ThisWorkbook
.SaveAs Filename:=MyPath & Cells(1, 2).Value & ".xls" '<===Cell B1 =
Change
End With

End Sub

This code does not make a control on the path of your folder.

Thunder




Thunder

Create buttom that saves current file in a given filename (Exc
 

"mamealemka" ha scritto nel messaggio
...
Hi Thunder

Thanks.


Hi mamealemka,

You're Welcome, De Nada, De Rien, Di Nulla, ????????, ????, ?? ???????

;-)

tHUNDER




All times are GMT +1. The time now is 11:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com