Automatically Save after Dynamic recalculation / updation

arshadmohamed

New Member
Joined
Jan 18, 2005
Messages
18
Iam using a Powerpoint presentation linked to a Excel work sheet to be updated daily..

The excel worksheet is made to open at Windows startup and it updates itself after comparing the sytem date accordingly..

Is there any way i can automatically save this excel file and close after the dynamic updation ?

How to create or add the any Macro only for this particular file?

Thanx for any help :)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

P Sitaram

Well-known Member
Joined
Jun 24, 2003
Messages
1,974
At the end of procedure that carries out the updation add the line:

ActiveWorkbook.Close SaveChanges:=True
 

arshadmohamed

New Member
Joined
Jan 18, 2005
Messages
18
Re: Automatically Save after Dynamic recalculation / updatio

Wel,

Where to add this command?

The updation i do, is kind of function comparing the local date, for which i use IF Today()

Do i have to create a Macro and add the above said comman?

How to Create a Macro which would apply only for this file alone?

sorry if iam not very clear..
 

P Sitaram

Well-known Member
Joined
Jun 24, 2003
Messages
1,974
Re: Automatically Save after Dynamic recalculation / updatio

okay, if the workbook does not have any code, do this:

To the left of the File menu, there is a small excel icon. Right click on the icon and choose `view code'. You will be taken to VBE-visual Basic Editor. In the top of the large white area, there will be two drop-down boxes. In the left han box choose `workbook'. You will be presented with two lines `Private Sub Workbook_Open' and End Sub. In between the lines, paste this code:

Code:
Private Sub Workbook_Open() ' Do not paste this line
    Dim response
    response = MsgBox("Save Changes and Close?", vbOKCancel)
    If response = vbCancel Then Exit Sub
    ActiveWorkbook.Close savechanges:=True
End Sub 'Don't paste this either

Now whenever the workbook is opened the user will be given an option to save and close the workbook
 

arshadmohamed

New Member
Joined
Jan 18, 2005
Messages
18
Re: Automatically Save after Dynamic recalculation / updatio

Thanx for the help..

It is prompting for Saving changes rite?

it does not requre for the file to be open.. coz its the Power Point Window dats gonna run..

Is it possible to make the file just close by itself? without any option ?
 

P Sitaram

Well-known Member
Joined
Jun 24, 2003
Messages
1,974
Re: Automatically Save after Dynamic recalculation / updatio

Yes, by this code:

Code:
Private Sub Workbook_Open()     
        ActiveWorkbook.Close savechanges:=True 
End Sub

After this, if you need to use the workbook, macros have to be disabled.
 

Forum statistics

Threads
1,148,053
Messages
5,744,534
Members
423,881
Latest member
Nguyen Vu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top