autosave function

A

AdinaC

Hello. I am setting up a worksheet that i need to allow others to access. I
have to be able to guarantee that the data they add is saved. I want to
create an autosave feature so that if the user does not save the document on
their own, it will save automatically when they close it. I have Excel 2003,
and have tried following some of the other people's questions about
downloading add in's from previous versions, but I don't get it. Having
Excel autosave every ... minutes doesn't help because I need to be able to
guarantee that any added data is saved before - or when - closing.

Thanks,

Adina
 
B

Bob Phillips

You don't need an add-in for this, just add this code to the workbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
A

AdinaC

Hi Bob,

Thank you for helping me. I did what you said, right click on Excel icon,
choose view code, but there is no where to paste. All I get is a greyed-out
screen with a few edit icons. Where do I paste?

Thanks,

Adina
 
B

Bob Phillips

Make sure that the ThisWorkbook code module is showing, double-click the
item in the explorer pane if not.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
A

AdinaC

Hi Bob,

You are the BEST!!!!! I couldn't paste the macro the first time. When I
tried to go into visual basic, it told me I didn't have enough memory.. I
thought it was just my computer, so we pasted your macro on another computer
and it worked. When I tried to open the shared file on my computer, that is
when Excel told me to change the security. Apparently it was set to high.
Now I have it on medium so I can choose whether or not to use the macro, and
it works great. We tested it, and it saved the data and didn't even require
the user to choose "yes" or anything. It just saved it without you knowing
and then when I opened it back up, there was the data. Thanks again, you are
the best!!

Adina
 

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

Top