Consulting

Results 1 to 5 of 5

Thread: Document Property - Total Editing Time

  1. #1

    Document Property - Total Editing Time

    So I've been wondering this for awhile and have not been able to uncover the answer after some research.

    As far as the document property "total editing time"...what exactly does it keep track of?

    For example: Does it keep track of the "total editing time":
    1. Starting with the time you open the document and ending when you save and close it? (regardless if you switch to another document or another window while such document is open--its just total time open period.)
    2. Starting with the time you open the document and then only the time the window is active? (with the total editing time "timer" off while such window does not have focus)
    3. Starting with the time you open the document and then only the time the window is active and you are actually entering text, subject to some sort of "time out" period? If there is a time out period what is it?
    If someone knows the specifics of how it tracks your editing time it would be very helpful to me.

    My goal is to create a toggle macro ("one button press" which I will probably put in the ribbon or in the QAT) which will show/hide the total editing time either in the title bar or the status bar.

    I am still looking into which objects I need to manipulate to achieve this.

    As always, any input is most appreciated.

    Best,
    Brian

  2. #2
    Here is a start:

    [VBA]Sub DisplayEditingTimeinTitleBar()
    'Displays the editing time in the title bar
    Dim dpLastSaveTime As DocumentProperty
    Dim dpTotalEditingTime As DocumentProperty
    Dim strCurrentCaption As String
    Set dpTotalEditingTime = ActiveDocument.BuiltInDocumentProperties("Total editing time")

    ActiveWindow.Caption = ActiveDocument.Name 'reset the name so there aren't multiple time _
    entries in the title bar
    strCurrentCaption = Replace(ActiveWindow.Caption, " [Compatibility Mode]", "") 'delete the _
    multiple "[Compatibility Mode]" text if it exists

    Select Case dpTotalEditingTime

    Case Is <= 60 ' editing time is less than 60 minutes we only need minutes
    ActiveWindow.Caption = dpTotalEditingTime & " Minutes - " _
    & strCurrentCaption

    Case Is > 60 'editing time is more than 60 minutes, put the document property which is the _
    form of an integer in a "friendlier" format and handle rounding errors
    ActiveWindow.Caption = Int(dpTotalEditingTime / 60) & " Hours " & _
    Int(((dpTotalEditingTime / 60) - Int(dpTotalEditingTime / 60)) * 60) & " Minutes - " _
    & strCurrentCaption

    End Select
    End Sub

    Sub ResetTotalEditingTime()
    'tester function used to reset total editing time to random times _
    use to test the select case statement in foo
    Dim objDialogBox As Object
    With WordBasic
    Set objDialogBox = .DialogRecord.FileSummaryInfo(False)
    .CurValues.FileSummaryInfo objDialogBox
    objDialogBox.EditTime = "545" '***RESET THE VALUE HERE***
    .FileSummaryInfo objDialogBox
    Set objDialogBox = Nothing
    End With
    End Sub[/VBA]

    Does anyone know how to make this toggle in the titlebar and update every x minutes while it is active in the titlebar? Or else have a suggestion of a way to view this information in a way that updates every x minutes while it is "viewable"?

    Best,
    Brian

  3. #3
    This is interesting and related...

    http://www.scribd.com/doc/55390264/G...k-in-Word-2010

  4. #4
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Brian,

    You've got two essential concepts going on with this question...

    1. The accuracy of the Total Editing Time property. I confess that I don't know much about that topic, although the link you posted is very interesting. It doesn't answer some of your specific questions, although I would think that some fairly simple tests would allow you to definitively answer the question to your satisfaction (and, since that link apparently indicates that this the accuracy/logic behind the edit time may be version specific, it would probably be a good idea to specify what version you're going to be testing in.

    2. The best way to create a persistent timer function which allows continual updates. This I can talk about with some knowledge.

    Personally, I'm very hesitant to create persistent (i.e., they last until the application shuts down) timers/monitors as overhead for the duration of my winword process. I much prefer to utilize whatever events already exist in Word (since Word is doing a lot of real-time monitoring anyway). It's more instinct than anything... but you can certainly create a "real-time" monitor process by using Application.Run combined with .OnTime (essentially creating you own independent thread). But if you don't work with existing events somehow, it becomes pretty tricky if your users regularly work on multiple documents.

    For example... if you have 8 different documents open, do you want to 8 different monitors all starting and stopping based on which document is currently open?

    As a programmer who primarily works with law firms, obviously the issue of "editting time" is a pretty big one, since lawyers bill by the hour. But sitting there and reading a couple of paragraphs and thinking about the content while the document just "sits there" is just as valid in the "billable time" concept as actually doing some typing.

    So I have my doubts about whether it is truly possible to automate this concept (even if you are able to solve the technical hurdles of multiple-open documents), there is still the issue of accuracy... i.e., someone combining content from multiple open documents into a single new document... the "new" document may have the lowest "edit time" because that's just where the end-user was pasting stuff he/she found in the other documents, but that might actually be the one where the "edit time" actually matters).

    However, if I were to approach trying to do this... I would look at both the DocumentChange event, the WindowSelectionChange event (as a time to choose to automatically refresh your window.caption property), and I would look at having those events store a "current edit time" value "somewhere."

    The somewhere could be a text file containing the document name and the latest "total" time, which you could then grab later in a multi-document situation. Otherwise, maybe I'd look at creating a public 2 dimensional array which held the doc name and latest total time.... but you'll lose that info if Word crashes, so it might be safer to be storing to an external file at some interval... and then updating your window.caption at an interval.

    I think, at the end of the day, it might be too flawed of a concept to have a general answer-- you have to narrowly define how you want it to work for your specific scenario, and then know exactly how and when it will "break" so that it can be a "helper" utility, but probably never a completely independent and accurate function.

    Trying to help brainstorm...

  5. #5
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,433
    Location
    AFAIK, the editing time stats are simply a compilation of the durations for which a document has been open between saves (ie opening & closing a document without saving doesn't count). Not a terribly meaningful statistic and one that can easily be re-set to 0 by simply using File|Save As. For example, I created a new document, waited 14 minutes before doing anything, typed 'hello' and saved it. Total editing time = 14 minutes. Using File|Save As then reduced that to 0.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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