Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Application.OnTIme

hi,

I created a copy macro within Excel that I need done at a
certain time each day. The copy macro (called copy3) is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?


thanks,
Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Application.OnTIme

Did you run Timer?

In article ,
"Mike" wrote:

hi,

I created a copy macro within Excel that I need done at a
certain time each day. The copy macro (called copy3) is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Application.OnTIme

Mike,

You need to call the procedure before it will do anything. Ideally, it
should be a in a module so that it can be called from different locations.

All in all, if you do not run the routine you posted, it will not work.


Robert
  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Application.OnTIme

Stupid question:

How do you run the timer?


Ideally I would like this to run automatically. That is
I would use Scheduled Tasks to bring the worksheet up
then later in the day have the copy macro run so I don't
want to have to run the timer unless this can be done
automatically when the spreadsheet comes up.


thanks



-----Original Message-----
Did you run Timer?

In article ,
"Mike" wrote:

hi,

I created a copy macro within Excel that I need done

at a
certain time each day. The copy macro (called copy3)

is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Application.OnTIme

You can do that too. But you need to add a call on the Workbook_Open event in
order to call the procedure. Then you can use another onTime to close the
workbook after a few seconds.

Have a look at ExcelTip for the code on how to unload the workbook after the
time has elapsed.

Robert


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Application.OnTIme

You could place the code in the ThisWorkbook module as a Workbook_Open Sub
which would run when the workbook is opened.

This would start the Timer, which would run copy3 at 13:00:00

If you are going to use Task Scheduler to open the workbook at a certain
time(13:00:00) each day, you wouldn't need the Application.OnTime code.

Just have the copy3 code in the Workbook_Open code. TS would open the
workbook, copy3 would run, more code would save and close the workbook if
desired.

Gord Dibben Excel MVP

On Sat, 7 Aug 2004 11:11:06 -0700,
wrote:

Stupid question:

How do you run the timer?


Ideally I would like this to run automatically. That is
I would use Scheduled Tasks to bring the worksheet up
then later in the day have the copy macro run so I don't
want to have to run the timer unless this can be done
automatically when the spreadsheet comes up.


thanks



-----Original Message-----
Did you run Timer?

In article ,
"Mike" wrote:

hi,

I created a copy macro within Excel that I need done

at a
certain time each day. The copy macro (called copy3)

is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?

.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Application.OnTIme

Gord,

Thank you very much. I can now automate everything.

Mike

-----Original Message-----
You could place the code in the ThisWorkbook module as a

Workbook_Open Sub
which would run when the workbook is opened.

This would start the Timer, which would run copy3 at

13:00:00

If you are going to use Task Scheduler to open the

workbook at a certain
time(13:00:00) each day, you wouldn't need the

Application.OnTime code.

Just have the copy3 code in the Workbook_Open code. TS

would open the
workbook, copy3 would run, more code would save and

close the workbook if
desired.

Gord Dibben Excel MVP

On Sat, 7 Aug 2004 11:11:06 -0700,


wrote:

Stupid question:

How do you run the timer?


Ideally I would like this to run automatically. That

is
I would use Scheduled Tasks to bring the worksheet up
then later in the day have the copy macro run so I

don't
want to have to run the timer unless this can be done
automatically when the spreadsheet comes up.


thanks



-----Original Message-----
Did you run Timer?

In article ,
"Mike" wrote:

hi,

I created a copy macro within Excel that I need done

at a
certain time each day. The copy macro (called

copy3)
is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual

basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?
.


.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Application.OnTIme

Thanks for the feedback Mike.

Gord

On Sat, 7 Aug 2004 14:40:31 -0700, "mike"
wrote:

Gord,

Thank you very much. I can now automate everything.

Mike

-----Original Message-----
You could place the code in the ThisWorkbook module as a

Workbook_Open Sub
which would run when the workbook is opened.

This would start the Timer, which would run copy3 at

13:00:00

If you are going to use Task Scheduler to open the

workbook at a certain
time(13:00:00) each day, you wouldn't need the

Application.OnTime code.

Just have the copy3 code in the Workbook_Open code. TS

would open the
workbook, copy3 would run, more code would save and

close the workbook if
desired.

Gord Dibben Excel MVP

On Sat, 7 Aug 2004 11:11:06 -0700,


wrote:

Stupid question:

How do you run the timer?


Ideally I would like this to run automatically. That

is
I would use Scheduled Tasks to bring the worksheet up
then later in the day have the copy macro run so I

don't
want to have to run the timer unless this can be done
automatically when the spreadsheet comes up.


thanks



-----Original Message-----
Did you run Timer?

In article ,
"Mike" wrote:

hi,

I created a copy macro within Excel that I need done
at a
certain time each day. The copy macro (called

copy3)
is
under the Modules portion in Visual basic.

I put the following in the Sheet2 page in Visual

basic:

Private Sub Timer()

Application.OnTime TimeValue("13:00:00"), "copy3"

End Sub


And it does not run the macro at 13:00.

What have I done wrong?
.


.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Application.OnTIme

I am having a similar problem. I'm attempting to get an excel file t
open up and auto open a macro. I am using Windows 2000 server wit
Scheduled Tasks. I set up a task with a batch file that looks lik
this:

c:\progra~1\micros~3\Office\Excel.exe D:\macro\test.xls

When I tell the task to run, it shows a status of running, howeve
never does anything. I don't see Excel open anywhere in the activ
processes. In fact, the process never stops running and I have t
manually tell it to end task.

I've tested this particular line in the Run prompt and the macro open
up and runs perfectly.

Any ideas why this isn't working

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.ontime from shared drive jlclyde Excel Discussion (Misc queries) 3 August 20th 09 09:42 PM
Find %ontime & SUMIF ontime ie: find matching sets within Range... Chris T-M Excel Worksheet Functions 3 October 10th 08 08:14 PM
OnTime VB [email protected] Excel Worksheet Functions 2 May 16th 06 08:43 PM
OnTime...Please Help Michael_I Excel Programming 9 May 24th 04 07:56 PM
Application.OnTime and Visual C++ cdupain Excel Programming 0 November 12th 03 10:11 AM


All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"