Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default Time Tracker

Hi all,

I am currently creating a time tracker but I am concerned with maybe I
should change my design at this early stage as I feel it may not be as
accurate as I wanted.

I basically have a form with a load of option buttons and they are the
'tasks', the code behind one of them for example is:

Private Sub InPutting_Click()

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "Started" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "at" & TxtDelim & CellDelim &
CStr(Time())
Print #1, MyString
Close #1

End Sub

Private Sub InPutting_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "Stopped" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "at" & TxtDelim & CellDelim &
CStr(Time())
Print #1, MyString
Close #1

End Sub


Now, this puts the data in as two lines, a start and a finish, I could
do with the whole activity being logged as one line with just a
duration instead of a start and finish and that would save me a whole
load of headaches.

But I cant work out how to design and or code it,

Any ideas anyone bearing in mind I am a real beginner with vba?

Duncan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Time Tracker

You would probably need a public variable which you initialize in

Public StartTime as Date

Private Sub InPutting_Click()
StartTime = Time
End sub

then in the exit code, subtract the value of this variable from the current
time.

Without knowing more about the situation, this would be my guess.

--
Regards,
Tom Ogilvy


"Duncan" wrote:

Hi all,

I am currently creating a time tracker but I am concerned with maybe I
should change my design at this early stage as I feel it may not be as
accurate as I wanted.

I basically have a form with a load of option buttons and they are the
'tasks', the code behind one of them for example is:

Private Sub InPutting_Click()

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "Started" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "at" & TxtDelim & CellDelim &
CStr(Time())
Print #1, MyString
Close #1

End Sub

Private Sub InPutting_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "Stopped" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "at" & TxtDelim & CellDelim &
CStr(Time())
Print #1, MyString
Close #1

End Sub


Now, this puts the data in as two lines, a start and a finish, I could
do with the whole activity being logged as one line with just a
duration instead of a start and finish and that would save me a whole
load of headaches.

But I cant work out how to design and or code it,

Any ideas anyone bearing in mind I am a real beginner with vba?

Duncan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default Time Tracker

(Apologies for the duplicate posts!)

Tom:

My subs now look like

Private Sub InPutting_Click()
StartTime = Time
End Sub
Private Sub InPutting_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "has been" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "for" & TxtDelim & CellDelim & Time()
- StartTime
Print #1, MyString
Close #1

End Sub

But when i do it it only logs the end time, is it not minusing it
correctly?

Duncan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Time Tracker

You didn't declare the Public Variable

Public StartTime as Date

Private Sub InPutting_Click()
StartTime = Time
End Sub


Private Sub InPutting_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "has been" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "for" & TxtDelim & CellDelim & Time()
- StartTime
Print #1, MyString
Close #1

End Sub



---------------------
a demo from the immediate window:

StartTime = Time

' pause for a short amount of time, then:

? format(time - StartTime,"hh:mm:ss")
00:00:21
--
Regards,
Tom Ogilvy


"Duncan" wrote:

(Apologies for the duplicate posts!)

Tom:

My subs now look like

Private Sub InPutting_Click()
StartTime = Time
End Sub
Private Sub InPutting_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim TxtDelim, CellDelim
TxtDelim = Chr(34)
CellDelim = ","
Open "G:\LEVY_GNT\GRANTS\Processing Team - TT\Time Tracker" &
"\data.csv" For Append As #1
MyString = TxtDelim & Application.UserName & TxtDelim & CellDelim &
TxtDelim & "has been" & TxtDelim & CellDelim & TxtDelim & "Inputting" &
TxtDelim & CellDelim & TxtDelim & "for" & TxtDelim & CellDelim & Time()
- StartTime
Print #1, MyString
Close #1

End Sub

But when i do it it only logs the end time, is it not minusing it
correctly?

Duncan


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default Time Tracker

Tom,

Many thanks, I have it working now.

Duncan



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
Help for Time tracker updation Igneshwara reddy[_2_] Excel Worksheet Functions 1 May 25th 09 05:28 PM
Tracker CX Manager NY Excel Worksheet Functions 2 September 12th 08 12:27 AM
MIS tracker Raj Excel Worksheet Functions 0 May 24th 06 02:38 PM
Time Tracker Duncan[_5_] Excel Programming 1 May 17th 06 02:19 PM
How can I set up a page tracker? Tom Excel Programming 1 February 6th 05 10:42 AM


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