Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default button on a timer

i'm writting a little something in excel and i need to have a button
(visual basic form type) pressed every 3 minutes...any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default button on a timer

Change the scope of the button from private to public and then write a
recursive sub to call the button click porcedure. Something like this

'**** In a standard code module
Public Sub PressTheButton()
Application.OnTime Now() + TimeSerial(0, 0, 10), "PressTheButton"
Call Sheets("Sheet1").CommandButton1_Click
End Sub

'**** In the Worksheet
Public Sub CommandButton1_Click()
MsgBox "Tada"
End Sub
--
HTH...

Jim Thomlinson


" wrote:

i'm writting a little something in excel and i need to have a button
(visual basic form type) pressed every 3 minutes...any suggestions?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default button on a timer

I get the error:

"Object doesn't support this property or method"

for the
Call Sheets("Sheet1").CommandButton1_Click

help!



Jim Thomlinson wrote:
Change the scope of the button from private to public and then write a
recursive sub to call the button click porcedure. Something like this

'**** In a standard code module
Public Sub PressTheButton()
Application.OnTime Now() + TimeSerial(0, 0, 10), "PressTheButton"
Call Sheets("Sheet1").CommandButton1_Click
End Sub

'**** In the Worksheet
Public Sub CommandButton1_Click()
MsgBox "Tada"
End Sub
--
HTH...

Jim Thomlinson


" wrote:

i'm writting a little something in excel and i need to have a button
(visual basic form type) pressed every 3 minutes...any suggestions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default button on a timer

That exact code works for me. Did you rememeber to change the scope of the
click procedure?

'Note the key word Public (not Private)
Public Sub CommandButton1_Click()
--
HTH...

Jim Thomlinson


" wrote:

I get the error:

"Object doesn't support this property or method"

for the
Call Sheets("Sheet1").CommandButton1_Click

help!



Jim Thomlinson wrote:
Change the scope of the button from private to public and then write a
recursive sub to call the button click porcedure. Something like this

'**** In a standard code module
Public Sub PressTheButton()
Application.OnTime Now() + TimeSerial(0, 0, 10), "PressTheButton"
Call Sheets("Sheet1").CommandButton1_Click
End Sub

'**** In the Worksheet
Public Sub CommandButton1_Click()
MsgBox "Tada"
End Sub
--
HTH...

Jim Thomlinson


" wrote:

i'm writting a little something in excel and i need to have a button
(visual basic form type) pressed every 3 minutes...any suggestions?




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
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Timer TJ Excel Programming 1 July 9th 04 03:18 PM
Timer RK[_3_] Excel Programming 2 April 5th 04 06:03 AM
Timer Steve R[_2_] Excel Programming 3 December 5th 03 07:54 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"