Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time / Duration for Word 2000 2

Status
Not open for further replies.

AntonioAnsell

Technical User
Mar 7, 2004
70
GB
Hi,

I'm looking to add a duration / time to my text in MS Word 2000.

I need it so I can read to read to time.

Is there such an add in please?

Thank you!
Antonio
 
Antonio,

Not too sure what you are trying to accomplish. Could you re-word your question?
 
Hi...

Sorry,

I want to be able to type text and know at the end of what I have written how long it would take me to read

Similar to knowing how many words are written at the end of a document.

It's usually 3 words = 1 second to read

I suppose as an example, what I have written here would take 15 seconds to read. But instead of timing myself at the end of the document, Word would automatically tell me it would take 15 seconds to read!
 
Would that not simply be the product of word count and some constant?

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Do not need a constant if you use your estimated time to read. This displays as a message box, but you could dump it into a field, or a bookmark, or simply type it into the document. You would have to run this. It will not do this as a ongoing process. You must either make a selection of text, or run it for the whole document. This uses your 3 words a second. May want to do some trimming to remove excessively "accurate" second count. Must say, I am not sure I see the point to this....

Code:
Sub TestSelection()
Dim r As Range
Set r = Selection.Range
MsgBox "This selection has " & r.ComputeStatistics(wdStatisticWords) & _
        " word(s), and will take " & _
            r.ComputeStatistics(wdStatisticWords) / 3 & " seconds to read."
Set r = Nothing
End Sub

Sub TestWholeDocument()
MsgBox "This document has " & ActiveDocument.ComputeStatistics(wdStatisticWords) & _
        " word(s), and will take " & _
            ActiveDocument.ComputeStatistics(wdStatisticWords) / 3 & " seconds to read."
End Sub

Gerry
 
Thanks guys...

I'm a radio journalist, so writing / reading to time is very important.

I haven't a clue where to start with code, but I guess with the suggestion above I can research into in and use that!
 
Try this, Antonio.

Copy Gerry's code above.
Open Word fresh.
Hit Alt+F11.
Double-click Normal on the left-hand side.
From the menu, choose Insert-Module.
Paste the code into the code window at right.
Hit the save diskette.

You're saving this code in your normal.dot file so that you can use it on ANY file.

Now, go to Tools-Customize, Commands tab. ON the left, choose Macros. On the right, choose "TestSelection" and drag up to your toolbar. Close the customize dialog.

Open any file.
Select any amount of text (or Ctrl+A to choose a whole document), click the button to run the macro.

Anne Troy
Killer Coder Live Chat!
 
THANK YOU - THANK YOU - THANK YOU!

Fumei - Thank you for weriting that bit of code for me - that was so kind of you and I am very grateful!

Dreamboat - Thank you too for guiding me through with instructions on how to use the code!

Thanks to both of you - I've got exactly what I needed and something which I hunted for on the net and found it didn't exist!

Antonio
 
One further question...

Am I able to rename the module, to say: Time Calculator so it looks smarter in the tool bar, instead of it saying: Normal.Module1.TestSelection

Thank you!
 
Yes Anne ...yes, you may use the code. Heck why not, par'ner? Oh come to think...doh, silly me, I DID have a patent on that. Shucks...I never should have posted that. Darn.

Thanks for the added post to say what to do with it!

Just for interest sakes, if anyone wondered..., the reason TestSelection uses a range object (the r) and the WholeDocument does not, is ComputeStatistics is a property of a Range object. The Selection object itself does not have ComputeStats. The Range and Selection objects are very similar - this is one of the differences. So the code creates a range object from the selection, THEN you can use ComputeStats.


Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top