+ Reply to Thread
Results 1 to 2 of 2

Time Tracker

Hybrid View

Guest Time Tracker 05-17-2006, 09:10 AM
Guest RE: Time Tracker 05-17-2006, 09:25 AM
  1. #1
    Duncan
    Guest

    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 can work out how to design and or code it,

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

    Duncan


  2. #2
    Tom Ogilvy
    Guest

    RE: 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 can work out how to design and or code it,
    >
    > Any ideas anyone bearing in mind I am a real beginner with vba?
    >
    > Duncan
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1