A Button that saves a workbook in the background

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top