ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save workbook button on Userform (https://www.excelbanter.com/excel-programming/429783-save-workbook-button-userform.html)

Morlin

Save workbook button on Userform
 
I have a Userform that I submit data to. The data can also repopulate
the userform using a Lookup button. What i'd like to make is a button
on the userform that saves the entire workbook. I was hoping it would
be as easy as creating a commandbutton and creating a "save" macro but
it doesn't work. When I hit the save button and then close the entire
workbook my data is not there.

So my question. Can you create a button that will save the workbook
without having to exit to the spreadsheet and hitting save there?

Any help is appreciated.

Morlin

Save workbook button on Userform
 
Never Mind. I figured it out. I was not saving the code under the
correct private sub.

I was just having a brain fart. Here's what I ended up using.

Private Sub CommandButton1_Click()

ActiveWorkbook.save

End Sub

Per Jessen[_2_]

Save workbook button on Userform
 
Hi

The question is, the Userform in workbook you want to save?

Then you can use this:

ThisWorkbook.Save

otherwise you have to reference to the workbook by name,

Workbooks("MyBook.xls").Save

Hopes this helps.

---
Per


On 12 Jun., 15:59, Morlin wrote:
I have a Userform that I submit data to. *The data can also repopulate
the userform using a Lookup button. *What i'd like to make is a button
on the userform that saves the entire workbook. *I was hoping it would
be as easy as creating a commandbutton and creating a "save" macro but
it doesn't work. *When I hit the save button and then close the entire
workbook my data is not there.

So my question. *Can you create a button that will save the workbook
without having to exit to the spreadsheet and hitting save there?

Any help is appreciated.




All times are GMT +1. The time now is 08:35 AM.

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