Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default automatic macro execution

Dear reader,
is it possible in excel to have a macro to be executed for
example every 15 seconds automatically ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default automatic macro execution

Jos,

You can use the OnTime method to schedule a macro to execute at a specific
time. See www.cpearson.com/excel/ontime.htm for details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jos reulen" wrote in message
...
Dear reader,
is it possible in excel to have a macro to be executed for
example every 15 seconds automatically ?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default automatic macro execution

Dear Chip,
thank you very much for your info. I made a little program
for testing.
The code is included. However, I get an error message in
dutch; a free translation says
Cannot find the entrancepoint of DLL settimer in user32

have you any idea whats wrong ?

thank you very much

Public Declare Function settimer Lib "user32" (ByVal hwnd
As Long, ByVal nidevent As Long, ByVal uelapse As Long,
ByVal lptimerfunc As Long) As Long
Public Declare Function killtimer Lib "user32" (ByVal hwnd
As Long, ByVal nidevent As Long) As Long
Public timerid As Long
Public timerseconds As Single

Sub StartTimer()
timerseconds = 10 'how often to "pop"the timer
timerid = settimer(0&, 0&, timerseconds * 1000&,
AddressOfTimerproc)
End Sub

Sub endtimer()
On Error Resume Next
killtimer 0&, timerid
End Sub

Sub Timerproc(ByVal hwnd As Long, ByVal umsg As Long,
ByVal nidevent As Long, ByVal dwtimer As Long)

'the procedure is called by windows. Put your timer
related code here
StartTimer
Beep
endtimer
End Sub

Timerproc
End

-----Original Message-----
Jos,

You can use the OnTime method to schedule a macro to

execute at a specific
time. See www.cpearson.com/excel/ontime.htm for details

and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jos reulen" wrote in message
...
Dear reader,
is it possible in excel to have a macro to be executed

for
example every 15 seconds automatically ?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default automatic macro execution


-----Original Message-----
Dear Chip,
thank you very much for your info. I made a little excel

macro program for testing. It should give a beep every 10
seconds
The code is included. However, I get an error message in
dutch; a free translation says
Cannot find the entrancepoint of DLL settimer in user32

have you any idea whats wrong ?

thank you very much

Public Declare Function settimer Lib "user32" (ByVal hwnd
As Long, ByVal nidevent As Long, ByVal uelapse As Long,
ByVal lptimerfunc As Long) As Long
Public Declare Function killtimer Lib "user32" (ByVal

hwnd
As Long, ByVal nidevent As Long) As Long
Public timerid As Long
Public timerseconds As Single

Sub StartTimer()
timerseconds = 10 'how often to "pop"the timer
timerid = settimer(0&, 0&, timerseconds * 1000&,
AddressOfTimerproc)
End Sub

Sub endtimer()
On Error Resume Next
killtimer 0&, timerid
End Sub

Sub Timerproc(ByVal hwnd As Long, ByVal umsg As Long,
ByVal nidevent As Long, ByVal dwtimer As Long)

'the procedure is called by windows. Put your timer
related code here
StartTimer
Beep
endtimer
End Sub

Timerproc
End

-----Original Message-----
Jos,

You can use the OnTime method to schedule a macro to

execute at a specific
time. See www.cpearson.com/excel/ontime.htm for details

and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jos reulen" wrote in message
...
Dear reader,
is it possible in excel to have a macro to be executed

for
example every 15 seconds automatically ?



.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default automatic macro execution

Jos,

Function names in the Declare statements are case sensitive. Change
settimer to SetTimer and change killtimer to KillTimer, and omit the
Aliases.

Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long) As Long

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"jos reulen" wrote in message
...
Dear Chip,
thank you very much for your info. I made a little program
for testing.
The code is included. However, I get an error message in
dutch; a free translation says
Cannot find the entrancepoint of DLL settimer in user32

have you any idea whats wrong ?

thank you very much

Public Declare Function settimer Lib "user32" (ByVal hwnd
As Long, ByVal nidevent As Long, ByVal uelapse As Long,
ByVal lptimerfunc As Long) As Long
Public Declare Function killtimer Lib "user32" (ByVal hwnd
As Long, ByVal nidevent As Long) As Long
Public timerid As Long
Public timerseconds As Single

Sub StartTimer()
timerseconds = 10 'how often to "pop"the timer
timerid = settimer(0&, 0&, timerseconds * 1000&,
AddressOfTimerproc)
End Sub

Sub endtimer()
On Error Resume Next
killtimer 0&, timerid
End Sub

Sub Timerproc(ByVal hwnd As Long, ByVal umsg As Long,
ByVal nidevent As Long, ByVal dwtimer As Long)

'the procedure is called by windows. Put your timer
related code here
StartTimer
Beep
endtimer
End Sub

Timerproc
End

-----Original Message-----
Jos,

You can use the OnTime method to schedule a macro to

execute at a specific
time. See
www.cpearson.com/excel/ontime.htm for details
and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jos reulen" wrote in message
...
Dear reader,
is it possible in excel to have a macro to be executed

for
example every 15 seconds automatically ?



.



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
AUTOMATIC EXECUTION VB_User Excel Discussion (Misc queries) 5 December 28th 07 11:48 PM
Macro Execution C Brandt Excel Discussion (Misc queries) 2 July 13th 07 07:23 AM
How to automatic calculation and macro execution between 3 workbooks? c Excel Worksheet Functions 1 July 22nd 05 05:38 AM
slow macro execution Vasile Dumitrescu Excel Programming 1 October 7th 03 03:31 PM


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