Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel - macro - automatic initiation of a macro at a pre-specified "system time"

i am working on developing a test to be administered to a candidate.

how can control the process by time. when the test-taker clicks th
"start test" button, i can record the "system time" (DateTimeStart) a
that moment. but how do i ensure that at the end of a pre-specifie
duration, that is when "system time" becomes = DateTimeStart
TestDuration, a macro is initiated automatically which will end th
test.

am a novice in macro code writing. would appreciate if you can use
beginner's language in your respnse. many thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default excel - macro - automatic initiation of a macro at a pre-specified "system time"

Check out the OnTime method. Good description at
www.cpearson.com/excel/ontime.htm

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"arunjoshi " wrote in message
...
i am working on developing a test to be administered to a candidate.

how can control the process by time. when the test-taker clicks the
"start test" button, i can record the "system time" (DateTimeStart) at
that moment. but how do i ensure that at the end of a pre-specified
duration, that is when "system time" becomes = DateTimeStart +
TestDuration, a macro is initiated automatically which will end the
test.

am a novice in macro code writing. would appreciate if you can use a
beginner's language in your respnse. many thanks.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default excel - macro - automatic initiation of a macro at a pre-specified"system time"

It depends on what exactly the test consists of, but I'll try one approach

The code below assumes that the "start test" button runs a macro called
"start"

It also assumes that the candidate is entering her answers on a sheet
called "Sheet1"

The "start" macro makes Sheet1 visible and then sets a timer for 45
minutes, at the end of which time the macro "stoppem" will run.

The stoppem macro makes the sheet invisible and saves the workbook,
though currently it will ask the candidate's permission to save it.

Lots more security will be needed, like disabling the start button once
it has been run but the timer function should work OK

'''''''''''''''''''''''''''''''
Dim dateTimeStart As Date

Sub start()
Dim testDuration As Date
testDuration = TimeValue("00:45:00")
Sheets("Sheet1").Visible = True
dateTimeStart = Now
Application.OnTime _
dateTimeStart + testDuration, "stoppem"
End Sub

Sub stoppem()
With Sheets("Sheet1")
.Visible = xlVeryHidden
.Range("Z99").Value = dateTimeStart
End With
ThisWorkbook.Save
End Sub
'''''''''''''''''''''''''''''''''''''''''


arunjoshi < wrote:
i am working on developing a test to be administered to a candidate.

how can control the process by time. when the test-taker clicks the
"start test" button, i can record the "system time" (DateTimeStart) at
that moment. but how do i ensure that at the end of a pre-specified
duration, that is when "system time" becomes = DateTimeStart +
TestDuration, a macro is initiated automatically which will end the
test.

am a novice in macro code writing. would appreciate if you can use a
beginner's language in your respnse. many thanks.


---
Message posted from http://www.ExcelForum.com/


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default excel - macro - automatic initiation of a macro at a pre-specified "system time"

I have an example on my website
"Schedule a macro to run"

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"arunjoshi " wrote in message
...
i am working on developing a test to be administered to a candidate.

how can control the process by time. when the test-taker clicks the
"start test" button, i can record the "system time" (DateTimeStart) at
that moment. but how do i ensure that at the end of a pre-specified
duration, that is when "system time" becomes = DateTimeStart +
TestDuration, a macro is initiated automatically which will end the
test.

am a novice in macro code writing. would appreciate if you can use a
beginner's language in your respnse. many thanks.


---
Message posted from http://www.ExcelForum.com/



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
Excel Macro for time "Excel 2003" vijay[_3_] Excel Discussion (Misc queries) 2 September 24th 08 09:15 PM
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 16th 08 09:23 PM
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 15th 08 07:26 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
excel macro - macro initiation upon hitting the ener key arunjoshi[_2_] Excel Programming 1 April 28th 04 09:58 PM


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