start a macro everytime excel opens

J

Jeff

Hey group,

I have a macro for recording time worked during the
business day. I was wondering if it is possible to open a
sheet with a macro every time i start excel for the first
time in the morning only. I dont want it to update every
time its opened or closed i want to enable the end user on
that regard by clicking the button so they dont forget to
clock in and out

Regards and thanks

Jeff
 
F

Frank Kabel

Hi
why not put this file in the XLStart folder?. This way each time you
open Excel this file is opened also
 
G

Guest

Thanks Frank,

But i was trying to have it open only the first time
during the day when i come in usually before 9 and hide
after that so it doesnt pop up all the time. I appreciate
your help though

Jeff
 
J

Jeff Standen

How about an addin that has a name containing the date the addin was last
opened?

Something like this:
Sub TimeChecker()
On Error Resume Next
x = ThisWorkbook.Names("LastOpened").Name
If Err.Number <> 0 Then
Names.Add Name:="LastOpened", RefersTo:=Date
On Error GoTo 0
'run sub here
Else
If CDate(Right(ThisWorkbook.Names("LastOpened").RefersTo, 5)) <>
Date Then
ThisWorkbook.Names("LastOpened").RefersTo = Date
On Error GoTo 0
'run sub here
End If
End If
End Sub

Cheers,

Jeff
 
Top