Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default run a macro at a set time

I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in outlook.
any help?

Also, I'd like to be able to pass a parameter to the macro, but that doesn't
seem posible. I'd get round this in excel by putting the parameter in a cell
somewhere, but I don't know where to store it in Outlook.

Thanks in advance
Rob




  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default run a macro at a set time

Try the Outlook programming forum
=)
--
When you lose your mind, you free your life.


"Rob" wrote:

I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in outlook.
any help?

Also, I'd like to be able to pass a parameter to the macro, but that doesn't
seem posible. I'd get round this in excel by putting the parameter in a cell
somewhere, but I don't know where to store it in Outlook.

Thanks in advance
Rob




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default run a macro at a set time

hmm..
and then the user closes outlook..
so the ontime wont work.

safer to create a vbscript and
run that as a scheduled task


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Rob wrote :

I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in
outlook. any help?

Also, I'd like to be able to pass a parameter to the macro, but that
doesn't seem posible. I'd get round this in excel by putting the
parameter in a cell somewhere, but I don't know where to store it in
Outlook.

Thanks in advance
Rob

  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default run a macro at a set time

Thanks for the quick reply. Does the nature of what I'm doing change your
mind or do you still think a vbscript is the right way to go? If so, I'd
presumably need to create the scheduled task programatically. How would I go
about doing that?

context of the problem:
There's a macro which runs when an e-mail is received. It locks up the
machine while it runs, so I'm giving the user the option to defer running the
macro for 5 mins, a bit like a reminder. As this is a relatively short time,
I'm not too worried about the user closing Outlook. Also the nature of the
task performed is such that I could have it run when outlook re-opens.



"keepITcool" wrote:
hmm..
and then the user closes outlook..
so the ontime wont work.

safer to create a vbscript and
run that as a scheduled task

Rob wrote :
I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in
outlook. any help?

Also, I'd like to be able to pass a parameter to the macro, but that
doesn't seem posible. I'd get round this in excel by putting the
parameter in a cell somewhere, but I don't know where to store it in
Outlook.

Thanks in advance
Rob


  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default run a macro at a set time

This works with a reference to excel:

excel.Application.OnTime Now + TimeValue("00:05:00"), "myMacro"



"Rob" wrote:

I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in outlook.
any help?

Also, I'd like to be able to pass a parameter to the macro, but that doesn't
seem posible. I'd get round this in excel by putting the parameter in a cell
somewhere, but I don't know where to store it in Outlook.

Thanks in advance
Rob






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default run a macro at a set time


ah..

nope no script:


Probably:
I'd keep my routines inside outlook and monitor
outlook events StartUp and NewMail

Why does it lock up the machine?
is it just a boring routine that needs an instance of excel
(to log stuff in excel files) Does it need user input?

Why not create an excel instance from Outlook?
then maybe you can skip the scheduling and just
perform the routine in THAT instance.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Rob wrote :

Thanks for the quick reply. Does the nature of what I'm doing change
your mind or do you still think a vbscript is the right way to go?
If so, I'd presumably need to create the scheduled task
programatically. How would I go about doing that?

context of the problem:
There's a macro which runs when an e-mail is received. It locks up
the machine while it runs, so I'm giving the user the option to defer
running the macro for 5 mins, a bit like a reminder. As this is a
relatively short time, I'm not too worried about the user closing
Outlook. Also the nature of the task performed is such that I could
have it run when outlook re-opens.



"keepITcool" wrote:
hmm..
and then the user closes outlook..
so the ontime wont work.

safer to create a vbscript and
run that as a scheduled task

Rob wrote :
I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in
outlook. any help?

Also, I'd like to be able to pass a parameter to the macro, but
that doesn't seem posible. I'd get round this in excel by
putting the parameter in a cell somewhere, but I don't know where
to store it in Outlook.

Thanks in advance
Rob

  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default run a macro at a set time

Thanks. I used a combination of the two methods. I create an instance of
excel from outlook and call a macro within that process. Unfortunatly,
outlook still freezes until the called procedure is over, so I created a
dummy macro so that control was retrurned to outlook.

sub dummy 'called from outlook
application.ontime Now,"RealProcedure"
end sub
sub realprocedure
'...
end sub

Thanks again
Rob


"keepITcool" wrote:


ah..

nope no script:


Probably:
I'd keep my routines inside outlook and monitor
outlook events StartUp and NewMail

Why does it lock up the machine?
is it just a boring routine that needs an instance of excel
(to log stuff in excel files) Does it need user input?

Why not create an excel instance from Outlook?
then maybe you can skip the scheduling and just
perform the routine in THAT instance.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Rob wrote :

Thanks for the quick reply. Does the nature of what I'm doing change
your mind or do you still think a vbscript is the right way to go?
If so, I'd presumably need to create the scheduled task
programatically. How would I go about doing that?

context of the problem:
There's a macro which runs when an e-mail is received. It locks up
the machine while it runs, so I'm giving the user the option to defer
running the macro for 5 mins, a bit like a reminder. As this is a
relatively short time, I'm not too worried about the user closing
Outlook. Also the nature of the task performed is such that I could
have it run when outlook re-opens.



"keepITcool" wrote:
hmm..
and then the user closes outlook..
so the ontime wont work.

safer to create a vbscript and
run that as a scheduled task

Rob wrote :
I want to set a macro to run at a given time.

Application.OnTime 'does this in excel, but I can't find a way in
outlook. any help?

Also, I'd like to be able to pass a parameter to the macro, but
that doesn't seem posible. I'd get round this in excel by
putting the parameter in a cell somewhere, but I don't know where
to store it in Outlook.

Thanks in advance
Rob


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
Macro / function text time to 24hr excel time passed midnight fortotaling hr's Russmaz Excel Worksheet Functions 2 March 6th 09 04:58 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Help with Macro to Convert Date/Time to Time Only Bill[_26_] Excel Programming 5 August 25th 04 01:50 PM
excel - macro - automatic initiation of a macro at a pre-specified "system time" arunjoshi[_3_] Excel Programming 3 May 1st 04 09:42 AM


All times are GMT +1. The time now is 12:52 PM.

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"