Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
background commands running in Excel? | Excel Discussion (Misc queries) | |||
x log, y lin audio frequency chart | Charts and Charting in Excel | |||
How do I restore excel running in the background? | Excel Discussion (Misc queries) | |||
turn on audio in excel | Excel Discussion (Misc queries) | |||
Running Excel as a batch job AND in the background | Excel Programming |