Aj,

I read the below attached code

I have some questions about it, as i am keen to learn
application.ontime event

Why did we repeat the following line of code
Application.OnTime TimeValue("20:20:00"), "Close_and_Save"
in both Workbook_Open event and the Close_And_SAve sub?

Is it important to do that? Please help me understand this a bit.

Thanks

Harpreet Gujral

On Mar 8, 7:32 pm, Abhishek Jain <abhishek....@gmail.com> wrote:
> Dear Sacha,
>
> Open VBA > ThisWorkbook and paste this code -
>
> *Private Sub Workbook_Open()
>      Application.OnTime TimeValue("20:20:00"), "Close_and_Save"
> End Sub*
>
> Now modify your Close_and_Save module as below -
>
> *Sub Close_and_Save()
> Application.OnTime TimeValue("20:20:00"), "**Close_and_Save**"
> ActiveWorkbook.Close SaveChanges:=True
> End Sub
> *
> This will trigger your close and save macro at 8:20 PM. Adjust the time as
> per your need. You'll have to close and re-open the workbook to effect the
> changes you made every time in time value.
>
> Hope this helps.
>
> Cheers!
>
> AJ
>
>
>
> On Mon, Mar 8, 2010 at 6:01 PM, Sach1810 <sach1...@googlemail.com> wrote:
> > Hi,
>
> > I would like to transform the following macro so that it will work at
> > a set time
>
> > Sub Close_and_Save()
> > ActiveWorkbook.Close SaveChanges:=True
> > End Sub
>
> > help would be much appreciated
>
> > thanks
>
> > Sacha
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our Facebook Group @
> >http://www.facebook.com/group.php?gid=287779555678
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > HELP US GROW !!
>
> > We reach over 6,800 subscribers worldwide and receive many nice notes about
> > the learning and support from the group.Let friends and co-workers know they
> > can subscribe to group at
> >http://groups.google.com/group/excel-macros/subscribe- Hide quoted text -
>
> - Show quoted text -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to