Here are two macros. Let's assume that you have a spreadsheet that can be
opened either on a computer or by calling the computer. I further assume
that the control of Excel over the phone is limited. If you open the
spreadsheet over the phone, the macros will:
1. immediately record the time in column A of Sheet1
2. the recording is completely automatic
3. the next available cell in the column is used so no data is overwritten
4. after a ten second wait, the spreadhseet is saved and Excel is closed
If you open the spreadsheet on the computer rather than over the phone, you
have ten seconds to enter a value in cell B1.
Once a value has been placed in cell B1, the ten second count-down is
suspended and you have full comtrol.
Enter the following Event macro in the workbook code area:
Private Sub Workbook_Open()
fmt = "[$-F400]h:mm:ss AM/PM"
Sheets("Sheet1").Activate
If IsEmpty(Range("A1")) Then
Range("A1").Value = Now - Date
Range("A1").NumberFormat = fmt
Call leaving
Else
n = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(n, 1).Value = Now - Date
Cells(n, 1).NumberFormat = "[$-F400]h:mm:ss AM/PM"
Call leaving
End If
End Sub
Enter the following macro in a standard module:
Sub leaving()
' gsnuxx
whn = Now + TimeSerial(0, 0, 10)
While Now < whn
DoEvents
If Range("B1").Value <> "" Then
Exit Sub
End If
Wend
ActiveWorkbook.Save
Application.Quit
End Sub