ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro at specified time (https://www.excelbanter.com/excel-programming/420599-run-macro-specified-time.html)

SANDIND[_2_]

Run Macro at specified time
 
Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


Mike

Run Macro at specified time
 
It probably can with some complex coding. But I use Windows Task Scheduler
and it works Great !!!

"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


SANDIND[_2_]

Run Macro at specified time
 
HI Mike,

Thanks for your response, Can you please guide me through what you use.

What changes or addition I need to make to the code.
SS

"Mike" wrote:

It probably can with some complex coding. But I use Windows Task Scheduler
and it works Great !!!

"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


Mike H

Run Macro at specified time
 
Hi,

This workbook open module

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"
End Sub

and this in a standard module

Sub MySub()
Application.OnTime
TimeValue ("14:30:00"), "MyMacro"
'Do lots of things
End Sub

1. The workbook must be open for this to work so you can leave it open or
open it with Windows task scheduler.

2. AFAIK there are no issues with this on a shared drive.

Mike


"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


SANDIND[_2_]

Run Macro at specified time
 
Hi Mike H

Thanks a Lot !!

I am sorry I am knew to VB , Can you please tell me what do you mean by
Standard module, do I need to copy that in a new module.

And also can you please let me know that here :
TimeValue ("14:30:00"), "MyMacro"

In place of my macro, do I only need to type name of macro which I want to
run or the full code.

Thanks a lot for all your help.

SS

"Mike H" wrote:

Hi,

This workbook open module

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"
End Sub

and this in a standard module

Sub MySub()
Application.OnTime
TimeValue ("14:30:00"), "MyMacro"
'Do lots of things
End Sub

1. The workbook must be open for this to work so you can leave it open or
open it with Windows task scheduler.

2. AFAIK there are no issues with this on a shared drive.

Mike


"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


Mike H

Run Macro at specified time
 
Hi,

Alt +f11 to open VB editor. Double click 'This workbook' and past this in

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"' Change to your sub name
End Sub

Now right click 'This Workbook' and 'Insert Module' and paste your sub in.
Note that the first 2 lines of your sub must be
Application.OnTime
TimeValue ("14:30:00"), "MySub" 'Change to your sub name


Sub MySub() 'Change to your sub name
Application.OnTime
TimeValue ("14:30:00"), "MySub" 'Change to your sub name
'Your code
End Sub


Mike

"SANDIND" wrote:

Hi Mike H

Thanks a Lot !!

I am sorry I am knew to VB , Can you please tell me what do you mean by
Standard module, do I need to copy that in a new module.

And also can you please let me know that here :
TimeValue ("14:30:00"), "MyMacro"

In place of my macro, do I only need to type name of macro which I want to
run or the full code.

Thanks a lot for all your help.

SS

"Mike H" wrote:

Hi,

This workbook open module

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"
End Sub

and this in a standard module

Sub MySub()
Application.OnTime
TimeValue ("14:30:00"), "MyMacro"
'Do lots of things
End Sub

1. The workbook must be open for this to work so you can leave it open or
open it with Windows task scheduler.

2. AFAIK there are no issues with this on a shared drive.

Mike


"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS


SANDIND[_2_]

Run Macro at specified time
 
Thanks Mike H,

For detailed explanation.. I really appreciate your help and looking forward.

Regards, SS

"Mike H" wrote:

Hi,

Alt +f11 to open VB editor. Double click 'This workbook' and past this in

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"' Change to your sub name
End Sub

Now right click 'This Workbook' and 'Insert Module' and paste your sub in.
Note that the first 2 lines of your sub must be
Application.OnTime
TimeValue ("14:30:00"), "MySub" 'Change to your sub name


Sub MySub() 'Change to your sub name
Application.OnTime
TimeValue ("14:30:00"), "MySub" 'Change to your sub name
'Your code
End Sub


Mike

"SANDIND" wrote:

Hi Mike H

Thanks a Lot !!

I am sorry I am knew to VB , Can you please tell me what do you mean by
Standard module, do I need to copy that in a new module.

And also can you please let me know that here :
TimeValue ("14:30:00"), "MyMacro"

In place of my macro, do I only need to type name of macro which I want to
run or the full code.

Thanks a lot for all your help.

SS

"Mike H" wrote:

Hi,

This workbook open module

Private Sub Workbook_Open()
Application.OnTime TimeValue("14:30:00"), "MySub"
End Sub

and this in a standard module

Sub MySub()
Application.OnTime
TimeValue ("14:30:00"), "MyMacro"
'Do lots of things
End Sub

1. The workbook must be open for this to work so you can leave it open or
open it with Windows task scheduler.

2. AFAIK there are no issues with this on a shared drive.

Mike


"SANDIND" wrote:

Hi

I want to run a macro at specified time suppose 2.30 pm.

I have two clarrification(featues) regarding this : (1) Can this timed macro
run even if the workbook is closed (2) Workbook is placed in share drive.

If someone can help me with the macro having both the features then I would
really apprecite his efforts.

Thanks, SS



All times are GMT +1. The time now is 09:07 PM.

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