Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Msg Box Timer

Hello. I have a workbook with a Workbook_Open event in it that calls a main
sub in the workbook. I am scheduling this code to run via the Windows\Tasks
method. But, I would also like to manually open the file to perform work on
it without the code executing upon opening. So I was thinking if there was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the code
would not be called. If the popup times out 30 seconds, the sub would then
be called. Is this possible?? Thanks!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

since you schedule it to run why not check the time and it it isn't the
scheduled time, then exit.

Private Sub Workbook_Open()
if time < TimeValue("10:00 PM") or time TimeValue("11:00 PM") then
exit sub
end if
' current code
End Sub

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that calls a

main
sub in the workbook. I am scheduling this code to run via the

Windows\Tasks
method. But, I would also like to manually open the file to perform work

on
it without the code executing upon opening. So I was thinking if there

was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the code
would not be called. If the popup times out 30 seconds, the sub would

then
be called. Is this possible?? Thanks!!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Msg Box Timer

Hi Tom,

Hadn't thought of that. Does it make a huge difference if the job is
scheduled to run only once a week?

"Tom Ogilvy" wrote in message
...
since you schedule it to run why not check the time and it it isn't the
scheduled time, then exit.

Private Sub Workbook_Open()
if time < TimeValue("10:00 PM") or time TimeValue("11:00 PM") then
exit sub
end if
' current code
End Sub

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that calls a

main
sub in the workbook. I am scheduling this code to run via the

Windows\Tasks
method. But, I would also like to manually open the file to perform

work
on
it without the code executing upon opening. So I was thinking if there

was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the

code
would not be called. If the popup times out 30 seconds, the sub would

then
be called. Is this possible?? Thanks!!






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

Not unless you will be editing it during its normal run time. If that is
the case, then you could also check the day of the week.

--
Regards,
Tom Ogilvy


"Steph" wrote in message
...
Hi Tom,

Hadn't thought of that. Does it make a huge difference if the job is
scheduled to run only once a week?

"Tom Ogilvy" wrote in message
...
since you schedule it to run why not check the time and it it isn't the
scheduled time, then exit.

Private Sub Workbook_Open()
if time < TimeValue("10:00 PM") or time TimeValue("11:00 PM") then
exit sub
end if
' current code
End Sub

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that calls

a
main
sub in the workbook. I am scheduling this code to run via the

Windows\Tasks
method. But, I would also like to manually open the file to perform

work
on
it without the code executing upon opening. So I was thinking if

there
was
a popup upon opening that would count down 30 seconds, with the

"cancel
event" button on it. So I could open the file and hit cancel and the

code
would not be called. If the popup times out 30 seconds, the sub would

then
be called. Is this possible?? Thanks!!








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

to the OP. Is the application visible when it is run by the schedular. If
so, then I don't think UserControl will work. But I haven't tested it -
perhaps Tushar has.

--
Regards,
Tom Ogilvy

"Tushar Mehta" wrote in message
om...
An alternative to Tom's suggestion *might* be the application's
UserControl property. For more, check XL VBA help.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hello. I have a workbook with a Workbook_Open event in it that calls a

main
sub in the workbook. I am scheduling this code to run via the

Windows\Tasks
method. But, I would also like to manually open the file to perform

work on
it without the code executing upon opening. So I was thinking if there

was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the

code
would not be called. If the popup times out 30 seconds, the sub would

then
be called. Is this possible?? Thanks!!





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Msg Box Timer

Tom,

Unfortunately it is scheduled to run at 5pm Saturday. So it is quite
probable that the file will need to be edited around that time on workdays.
So, will this work? Thanks for your help!

Private Sub Workbook_Open()
if Weekday(Date, vbSaturday) < 1 then
if time < TimeValue("10:00 PM") or time TimeValue("11:00 PM") then
exit sub
end if
' current code
end if
End Sub

"Tom Ogilvy" wrote in message
...
Not unless you will be editing it during its normal run time. If that is
the case, then you could also check the day of the week.

--
Regards,
Tom Ogilvy


"Steph" wrote in message
...
Hi Tom,

Hadn't thought of that. Does it make a huge difference if the job is
scheduled to run only once a week?

"Tom Ogilvy" wrote in message
...
since you schedule it to run why not check the time and it it isn't

the
scheduled time, then exit.

Private Sub Workbook_Open()
if time < TimeValue("10:00 PM") or time TimeValue("11:00 PM") then
exit sub
end if
' current code
End Sub

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that

calls
a
main
sub in the workbook. I am scheduling this code to run via the
Windows\Tasks
method. But, I would also like to manually open the file to perform

work
on
it without the code executing upon opening. So I was thinking if

there
was
a popup upon opening that would count down 30 seconds, with the

"cancel
event" button on it. So I could open the file and hit cancel and

the
code
would not be called. If the popup times out 30 seconds, the sub

would
then
be called. Is this possible?? Thanks!!










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Msg Box Timer

Maybe I am missing something here...
Pressing the Shift key when clicking the Enable Macros button
disables the Open event.

Jim Cone
San Francisco, USA


"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that calls a main
sub in the workbook. I am scheduling this code to run via the Windows\Tasks
method. But, I would also like to manually open the file to perform work on
it without the code executing upon opening. So I was thinking if there was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the code
would not be called. If the popup times out 30 seconds, the sub would then
be called. Is this possible?? Thanks!!


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Msg Box Timer

Hi Tom,

What I tested some time ago was a VBS script that ran XL and opened a
particular workbook. The workbook had a _open event procedure
conditioned on the UserControl property.

I don't know what will happen if XL is opened directly by the Windows
scheduler. Hence the use of *might* in my post. ;-)

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
to the OP. Is the application visible when it is run by the schedular. If
so, then I don't think UserControl will work. But I haven't tested it -
perhaps Tushar has.


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Msg Box Timer

Hi, you asked:

Unfortunately it is scheduled to run at 5pm Saturday. So it is quite
probable that the file will need to be edited around that time on
workdays.
So, will this work?

Tom's suggestion should work for you. Here is my take on what Tom
suggested, "then you could also check the day of the week":

If WeekdayName(Weekday(Now)) = "Saturday" _
And Time TimeValue("5:00 PM") Then
'Run the report
Else
'Don't run report
Exit Sub
End If

HTH--Lonnie M.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

Exactly Lonnie
I don't know how precise schedular is, but if after 4:30 on Saturday would
be good for considering it as the scheduled run, then I would modify to

If WeekdayName(Weekday(Now)) = "Saturday" _
And Time TimeValue("4:30 PM") Then
'Run the report
Else
'Don't run report
Exit Sub
End If

Make sure WeekdayName is supported in your version of Excel. I forget which
version it was introduced in, but it was later than xl97.

--
Regards,
Tom Ogilvy


"Lonnie M." wrote in message
oups.com...
Hi, you asked:

Unfortunately it is scheduled to run at 5pm Saturday. So it is quite
probable that the file will need to be edited around that time on
workdays.
So, will this work?

Tom's suggestion should work for you. Here is my take on what Tom
suggested, "then you could also check the day of the week":

If WeekdayName(Weekday(Now)) = "Saturday" _
And Time TimeValue("5:00 PM") Then
'Run the report
Else
'Don't run report
Exit Sub
End If

HTH--Lonnie M.



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

Hard to say, but a side effect is that doing that disables all macros for
that workbook which might not be desirable.

--
Regards,
Tom Ogilvy

"Jim Cone" wrote in message
...
Maybe I am missing something here...
Pressing the Shift key when clicking the Enable Macros button
disables the Open event.

Jim Cone
San Francisco, USA


"Steph" wrote in message
...
Hello. I have a workbook with a Workbook_Open event in it that calls a

main
sub in the workbook. I am scheduling this code to run via the

Windows\Tasks
method. But, I would also like to manually open the file to perform

work on
it without the code executing upon opening. So I was thinking if there

was
a popup upon opening that would count down 30 seconds, with the "cancel
event" button on it. So I could open the file and hit cancel and the

code
would not be called. If the popup times out 30 seconds, the sub would

then
be called. Is this possible?? Thanks!!




  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Msg Box Timer

Tom,

On my Windows XP, xl2002 machine the
Workbook Open event does not fire, but other macros continue to work.

Regards,
Jim Cone
San Francisco, USA


"Tom Ogilvy" wrote in message
...
Hard to say, but a side effect is that doing that disables all macros for
that workbook which might not be desirable.

--
Regards,
Tom Ogilvy



"Jim Cone" wrote in message
...
Maybe I am missing something here...
Pressing the Shift key when clicking the Enable Macros button
disables the Open event.

Jim Cone
San Francisco, USA


  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msg Box Timer

I stand corrected - guess I usually choose to disable macros when I open
that way. So perhaps your way is the best way, but certainly prone to
forgetting to do it.

--
Regards,
Tom Ogilvy

"Jim Cone" wrote in message
...
Tom,

On my Windows XP, xl2002 machine the
Workbook Open event does not fire, but other macros continue to work.

Regards,
Jim Cone
San Francisco, USA


"Tom Ogilvy" wrote in message
...
Hard to say, but a side effect is that doing that disables all macros

for
that workbook which might not be desirable.

--
Regards,
Tom Ogilvy



"Jim Cone" wrote in message
...
Maybe I am missing something here...
Pressing the Shift key when clicking the Enable Macros button
disables the Open event.

Jim Cone
San Francisco, USA




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
Timer Brandon H Excel Discussion (Misc queries) 5 August 9th 07 01:54 PM
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Timer RK[_3_] Excel Programming 2 April 5th 04 06:03 AM
Timer Phil Excel Programming 4 February 6th 04 01:58 PM


All times are GMT +1. The time now is 12:42 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"