ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A Button that saves a workbook in the background (https://www.excelbanter.com/excel-programming/374172-button-saves-workbook-background.html)

yasser

A Button that saves a workbook in the background
 
Hello,

I want to create a button in an Excel Spreadsheet that will allow user users
to save the existing workbook in a specific directory (ie. C:\Census\"Value
from Cell A1".xls). Additionally, I would also like to have the file name to
be the sameas the text in cell A1 (CurrentFile) and when the button is
clicked, the user should not see the "SAVE AS" dialogue box or the dialogue
that says, "Do you want to replace the existing file?" dialogue.
Can someone please give me the VBA code that I need in order to execute the
above mentioned event?

Thanks,

Yasser

Alok

A Button that saves a workbook in the background
 
Hi
Use the following Sub

Sub SaveWithNameInA1()
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\Census\" & Sheet1.Cells(1, 1).Value & ".xls"
Application.DisplayAlerts = True
End Sub

and attach it to the button.


"yasser" wrote:

Hello,

I want to create a button in an Excel Spreadsheet that will allow user users
to save the existing workbook in a specific directory (ie. C:\Census\"Value
from Cell A1".xls). Additionally, I would also like to have the file name to
be the sameas the text in cell A1 (CurrentFile) and when the button is
clicked, the user should not see the "SAVE AS" dialogue box or the dialogue
that says, "Do you want to replace the existing file?" dialogue.
Can someone please give me the VBA code that I need in order to execute the
above mentioned event?

Thanks,

Yasser



All times are GMT +1. The time now is 12:37 AM.

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