Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Pop Up and Audio alarm running as background tasks.

Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pop Up and Audio alarm running as background tasks.

http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]


for scheduling code to run
http://www.cpearson.com/excel/ontime.htm

About events:

http://www.cpearson.com/excel.events.htm

Use the beforeclose event to cancel the close unless some specific condition
is met.

----------------------------
this code posted by Chip Pearson makes a userform come to the front:

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC

--

Regards,
Tom Ogilvy


"Gary Ainsworth" wrote in message
om...
Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Pop Up and Audio alarm running as background tasks.

Thanks for your help. Very useful indeed. Howevever, I am struggling
to get the macro to work. Basically it cannot find the macro. They are
both on the same sheet so why it cannot fond them I do not know. Both
macros are listed.

Thanks
Gazza

Public NextTime As Date
Public EndTime As Date


Sub StartCount()
EndTime = Now + TimeValue("00:00:15")
NextTime = Now + TimeValue("00:00:01")
ActiveSheet.Range("A1").NumberFormat = "hh:mm:ss"
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub

Sub Continuecount()
Dim sh As Worksheet
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then
Set sh = ActiveSheet
Worksheets("something").Activate
sh.Visible = xlSheetHidden
' call code to continue process
Else
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End If
End Sub


"Tom Ogilvy" wrote in message ...
http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]


for scheduling code to run
http://www.cpearson.com/excel/ontime.htm

About events:

http://www.cpearson.com/excel.events.htm

Use the beforeclose event to cancel the close unless some specific condition
is met.

----------------------------
this code posted by Chip Pearson makes a userform come to the front:

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC

--

Regards,
Tom Ogilvy


"Gary Ainsworth" wrote in message
om...
Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Pop Up and Audio alarm running as background tasks.

Do you really mean that they're in a worksheet module?

If yes, try moving all this code to a general module.



Gary Ainsworth wrote:

Thanks for your help. Very useful indeed. Howevever, I am struggling
to get the macro to work. Basically it cannot find the macro. They are
both on the same sheet so why it cannot fond them I do not know. Both
macros are listed.

Thanks
Gazza

Public NextTime As Date
Public EndTime As Date

Sub StartCount()
EndTime = Now + TimeValue("00:00:15")
NextTime = Now + TimeValue("00:00:01")
ActiveSheet.Range("A1").NumberFormat = "hh:mm:ss"
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub

Sub Continuecount()
Dim sh As Worksheet
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then
Set sh = ActiveSheet
Worksheets("something").Activate
sh.Visible = xlSheetHidden
' call code to continue process
Else
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End If
End Sub

"Tom Ogilvy" wrote in message ...
http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]


for scheduling code to run
http://www.cpearson.com/excel/ontime.htm

About events:

http://www.cpearson.com/excel.events.htm

Use the beforeclose event to cancel the close unless some specific condition
is met.

----------------------------
this code posted by Chip Pearson makes a userform come to the front:

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC

--

Regards,
Tom Ogilvy


"Gary Ainsworth" wrote in message
om...
Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Pop Up and Audio alarm running as background tasks.

Thanks Dave that fixed it. Can you explain when you should put the
code in a module or a worksheet please.

Dave Peterson wrote in message ...
Do you really mean that they're in a worksheet module?

If yes, try moving all this code to a general module.



Gary Ainsworth wrote:

Thanks for your help. Very useful indeed. Howevever, I am struggling
to get the macro to work. Basically it cannot find the macro. They are
both on the same sheet so why it cannot fond them I do not know. Both
macros are listed.

Thanks
Gazza

Public NextTime As Date
Public EndTime As Date

Sub StartCount()
EndTime = Now + TimeValue("00:00:15")
NextTime = Now + TimeValue("00:00:01")
ActiveSheet.Range("A1").NumberFormat = "hh:mm:ss"
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub

Sub Continuecount()
Dim sh As Worksheet
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then
Set sh = ActiveSheet
Worksheets("something").Activate
sh.Visible = xlSheetHidden
' call code to continue process
Else
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End If
End Sub

"Tom Ogilvy" wrote in message ...
http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]


for scheduling code to run
http://www.cpearson.com/excel/ontime.htm

About events:

http://www.cpearson.com/excel.events.htm

Use the beforeclose event to cancel the close unless some specific condition
is met.

----------------------------
this code posted by Chip Pearson makes a userform come to the front:

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC

--

Regards,
Tom Ogilvy


"Gary Ainsworth" wrote in message
om...
Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Pop Up and Audio alarm running as background tasks.

I try to only put procedures in the Thisworkbook module and the sheet modules
that can be started by using those dropdowns on the top of the code window.

The workbook_open, worksheet_change type stuff.

(And code that is associated with controls from the ControlToolbox toolbar,
too.)



Gary Ainsworth wrote:

Thanks Dave that fixed it. Can you explain when you should put the
code in a module or a worksheet please.

Dave Peterson wrote in message ...
Do you really mean that they're in a worksheet module?

If yes, try moving all this code to a general module.



Gary Ainsworth wrote:

Thanks for your help. Very useful indeed. Howevever, I am struggling
to get the macro to work. Basically it cannot find the macro. They are
both on the same sheet so why it cannot fond them I do not know. Both
macros are listed.

Thanks
Gazza

Public NextTime As Date
Public EndTime As Date

Sub StartCount()
EndTime = Now + TimeValue("00:00:15")
NextTime = Now + TimeValue("00:00:01")
ActiveSheet.Range("A1").NumberFormat = "hh:mm:ss"
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub

Sub Continuecount()
Dim sh As Worksheet
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then
Set sh = ActiveSheet
Worksheets("something").Activate
sh.Visible = xlSheetHidden
' call code to continue process
Else
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End If
End Sub

"Tom Ogilvy" wrote in message ...
http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]


for scheduling code to run
http://www.cpearson.com/excel/ontime.htm

About events:

http://www.cpearson.com/excel.events.htm

Use the beforeclose event to cancel the close unless some specific condition
is met.

----------------------------
this code posted by Chip Pearson makes a userform come to the front:

Try the following, for Excel 2000 and later.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long

Sub ShowTheForm()
Dim FHwnd As Long
Load UserForm1
FHwnd = FindWindow("ThunderDFrame", UserForm1.Caption)
If FHwnd Then
SetForegroundWindow FHwnd
End If
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC

--

Regards,
Tom Ogilvy


"Gary Ainsworth" wrote in message
om...
Hi,
I am researching on how to create and implement a VBA app. to run in
the background and then 'alarm' when a certain time has elapsed and
then a certain temperature value has been reached. The sheet will be
updated by an add in for Aspen Process Explorer but I need help with
the following please:

1/ How can I get the program to run 'invisibly' as it were and then
make the app become active when not so. (is it appactivate?)
2/ What is the best way to achieve a 'pop up' and 'audio' alarms from
either the countdown timer or a value being matched?
3/ How can I stop the application from being closed down unauthorised.
(i.e. it needs to continue to run in the backround while other apps
are used.)

Thanks for any pointers
Regards
Gary

P.S.
I have had a search through the group but a little specific help would
be greatly appreciated.


--

Dave Peterson

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
background commands running in Excel? AnalystMark Excel Discussion (Misc queries) 1 January 26th 10 05:42 PM
x log, y lin audio frequency chart Jim Charts and Charting in Excel 3 December 27th 07 04:15 PM
How do I restore excel running in the background? BillS Excel Discussion (Misc queries) 0 August 31st 06 08:26 PM
turn on audio in excel Linda Excel Discussion (Misc queries) 1 March 20th 06 05:04 PM
Running Excel as a batch job AND in the background GB[_3_] Excel Programming 0 August 30th 03 01:08 PM


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