View Single Post
  #8   Report Post  
GWB Direct
 
Posts: n/a
Default

This worked. Thank you for all your help with this issue.
--
Gary Baker


"Gord Dibben" wrote:

Auto_Open Subs must be placed into a General Module.

Not sheet or Thisworkbook.

If in This workbook you would name it Sub Workbook_Open()


Gord Dibben Excel MVP

On Wed, 4 May 2005 08:10:02 -0700, "GWB Direct"
wrote:

This code doesn't work when the workbook opens or closes. It works when I
manually run the macros. Can it start auto open when the workbook is opened
and auto close when the worbook is closed? Does the codes need to be in this
workbook to work. I have it in Sheet1 because I have another code in this
workbook that closes the workbook when the user opens and closes 3 times. I
want to use this code to show how many times a user has left.

Sub Auto_Open()
Dim tm1 As Date
Dim num As Integer
tm1 = Now()
tm1 = Format(Time, ShortTime)
Sheets("Order Form").Select
Range("A2").Value = tm1
num = Range("B1").Value
Range("B1").Value = num + 1
End Sub
Sub Auto_Close()
Dim tm2 As Date
Dim tm As Date
tm2 = Now()
tm2 = Format(Time, ShortTime)
Sheets("Order Form").Select
Range("A3").Value = tm2 - Range("A2").Value
tm = Range("A1").Value + Range("A3").Value
Range("A1:A3").ClearContents
Range("A1").Value = tm
Range("A1").Select
ThisWorkbook.Save

End Sub