Computer Hope

Microsoft => Microsoft Windows => Windows XP => Topic started by: Nicholasia on November 07, 2010, 01:58:10 AM

Title: print record of minimized Word documents?
Post by: Nicholasia on November 07, 2010, 01:58:10 AM
Hello,
I would very much appreciate it if somebody would tell me whether it is possible to print minimized Word documents (i.e. just the file names) so as to have a record.  At present, I write down by hand all of the files I've been working on during the day, in order to be able to come back to them the next day. As I am a teacher, this amounts to a lot of work when I'm already knackered!
Cheers and thanks in advance,
Nicholas
Title: Re: print record of minimized Word documents?
Post by: Salmon Trout on November 07, 2010, 03:39:03 AM
If you have MS Word 2003 or earlier the maximum size of the Recent Documents List is 9, but in Word 2007 this went up to 50. So which version is it?
Title: Re: print record of minimized Word documents?
Post by: Nicholasia on November 07, 2010, 06:31:38 AM

If you have MS Word 2003 or earlier the maximum size of the Recent Documents List is 9, but in Word 2007 this went up to 50. So which version is it?

Hi Salmon Trout,

This sounds to be precisely what I'm looking for! I have Word 2003. I suppose that that means that I am restricted to seeing only the names of the last 9 documents I've opened. I should upgrade!

In the meantime, however, can you please tell me where to find "Recent documents," in Word 2003, as well as how to print from there (if possible) so as to have a record/list in hard copy for the following day? 

Thank you so much! (It's 8h20 Sunday -- still on Daylight Savings --  and I just got up in order to go to a rendez-vous later this morning, so I won't be back here until noon, or so.  I write that to explain a tardy reply from me today, in anticipation of your writing back. I realise that you have to sleep too, so you may not be able to reply for a while, but please I HOPE you do!)

Cheers, Nicholas
Title: Re: print record of minimized Word documents?
Post by: Salmon Trout on November 07, 2010, 07:44:31 AM
In Word 2003:

Select the Tools item on the Menubar, then choose the Options menu item, then click the General tab. Make sure the checkbox next to "Recently used file list" is checked, and set the number of entries to 9, the maximum. Thereafter, the list will appear at the bottom of your Files menu when you open it, with the most recent file topmost in the list.

If you have the Word menus set to the "collapsed" state, you may have to click the little double down pointing chevrons at the bottom of the options that drop down, or else set full menus by choosing Tools > Customize > Options and checking "Always show full menus"


Title: Re: print record of minimized Word documents?
Post by: Nicholasia on November 07, 2010, 01:16:10 PM
Hi Salmon Trout,
Thanks for telling me so precisely where to find "Recent Documents". I have them now and it's wonderful even though there can only be nine (as you said) with Word 2003. 

Can you tell me whether I am able to print these -- for future reference?

Thanks again!
Nicholas
Title: Re: print record of minimized Word documents?
Post by: DrJamesWright on November 07, 2010, 08:02:56 PM
yep that solved my problem to so thank simon!
Title: Re: print record of minimized Word documents?
Post by: Nicholasia on November 07, 2010, 08:45:12 PM
Hi,
I am not sure who "Simon" is. Perhaps you mean "Salmon". At any rate, I'd like to thank Salmon Trout again. I am wondering, however, whether it is possible to print a copy of the "Recent Documents"?

Nicholas
Title: Re: print record of minimized Word documents?
Post by: Salmon Trout on November 08, 2010, 01:00:21 AM
I am wondering ... whether it is possible to print a copy of the "Recent Documents"?

I do not know of any way to print the MS Word Recent Documents List from within Word itself. Maybe somebody else will have an idea?
Title: Re: print record of minimized Word documents?
Post by: Sidewinder on November 08, 2010, 05:32:32 AM
The MRU is stored in the registry. Unfortunately it is stored as a  sequence of null-terminated strings which I could not figure out how to represent in a batch file. This little snippet of VBScript code may help:

Code: [Select]
' List the documents in the Word MRU registry key
'
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
strKeyPath = "Software\Microsoft\Office\11.0\Common\Open Find\Microsoft Word\Settings\Save As\File Name MRU"
strValueName = "Value"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
  strComputer & "\root\default:StdRegProv")
 
oReg.GetMultiStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, arrValues

If Right(LCase(WScript.FullName), 11) = "cscript.exe" Then
For Each strValue In arrValues
WScript.Echo "Document - " & strValue
Next
Else
For Each strValue In arrValues
strBlock =  strBlock & "Document - " & strValue & vbCrLf
Next
WScript.Echo strBlock
End If

Save the script with a VBS extension. It can be run from the command prompt as cscript scriptname.vbs or wscript scriptname.vbs If run with the former, output will be directed to the console as a list of documents. If run with the latter, outout will be a single window with all the documents listed. To produce a hardcopy, use cscript and redirect the output to your printer Ex: cscript scriptname.vbs > lpt1 .

Note: I'm still using Word XP (2002) so I got the Word 2003 registry key from the internet. With any luck it is correct. In any case, the registry is used only for reading, so there is no danger of mucking it up.

Good luck.  8)
Title: Re: print record of minimized Word documents?
Post by: oldun on November 08, 2010, 05:39:10 AM
You may be able to do it using vbscript.

Copy and paste the code into a text file, and save it as worddocs.vbs, then double-click on the file to run it. Or open a command prompt window where you saved the file, then enter the filename and press enter.

If all goes well, a text file named "ListOfDocuments.txt" containing the recently edited documents will appear on the desktop.

Code: [Select]
set ofso=createobject("scripting.filesystemobject")
set oshell=createobject("wscript.shell")
set outfile=ofso.createtextfile(oshell.specialfolders("desktop") & "\ListOfDocuments.txt", true)
path=oshell.expandenvironmentstrings("%userprofile%") & "\recent"
for each ofile in ofso.getfolder(path).files
  if(instr(1,ofile.path,".doc")) then
    outfile.writeline(oshell.createshortcut(ofile.path).targetpath)
  end if
next
outfile.close()
wscript.echo "See ""ListOfDocuments.txt"" on the Desktop"
Title: Re: print record of minimized Word documents?
Post by: Nicholasia on November 08, 2010, 07:40:14 AM
Hi,
I have clicked the "Reply"at the bottom of the last post instead of replying to each individually. I hope that you all  will see this. I like to thank  collectively Salmon Trout, Sidewinder and Oldun for your help!

My initial and most basic questions have been answered (i.e. I know now about the "Recent Documents,"" and that I cannot print ti directly from Word) and you have given me some homework, of a sort! - homework in the best sense of the word (to help me!)

Thanks again and have a great week!

Nicholas
Title: Re: print record of minimized Word documents?
Post by: Salmon Trout on November 08, 2010, 11:11:28 AM
Quote from: sidewinder
Good luck.

Code: [Select]
S:\Test\Vbs\Word-Recent-Docs\swinder1.vbs(15, 4) Microsoft VBScript runtime error: Object not a collection
Title: Re: print record of minimized Word documents?
Post by: Sidewinder on November 08, 2010, 02:07:25 PM
Code: [Select]
S:\Test\Vbs\Word-Recent-Docs\swinder1.vbs(15, 4) Microsoft VBScript runtime error: Object not a collection

There is always a chance the registry key is wrong, but I don't think so. I used this (http://support.microsoft.com/kb/826208) to help me out. After finding the Microsoft Word key, I further refined it to Settings\Save As\File Name MRU as the subkey.

I'll wait for the OP to return with any comments. I cannot reproduce the error.

 8)
Title: Re: print record of minimized Word documents?
Post by: Salmon Trout on November 08, 2010, 02:19:47 PM
I cannot reproduce the error.

Identical error in Windows 7 Professional 64 bit and XP Professional 32 bit both with Office 2003 installed.

Code: [Select]
swinder1.vbs(15, 4) Microsoft VBScript runtime error: Object not a collection
Line 15:

Code: [Select]
   For Each strValue In arrValues





Title: Re: print record of minimized Word documents?
Post by: Sidewinder on November 09, 2010, 05:42:00 AM
Normally I do not post error trapping so as to emphasize method and reduce code clutter. I suspect the error thrown is due to an empty MRU list.

Code: [Select]
' List the documents in the Word MRU registry key
'
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
strKeyPath = "Software\Microsoft\Office\11.0\Common\Open Find\Microsoft Word\Settings\Save As\File Name MRU"
strValueName = "Value"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
  strComputer & "\root\default:StdRegProv")
 
oReg.GetMultiStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, arrValues
If arrValues(0) = "" Then
WScript.Echo "MRU List Is Empty"
WScript.Quit
End If

If Right(LCase(WScript.FullName), 11) = "cscript.exe" Then
For Each strValue In arrValues
WScript.Echo "Document - " & strValue
Next
Else
For Each strValue In arrValues
strBlock =  strBlock & "Document - " & strValue & vbCrLf
Next
WScript.Echo strBlock
End If

Sorry for any confusion.  8)
Title: Re: print record of minimized Word documents?
Post by: melissagish10 on November 09, 2010, 04:32:11 PM
The MRU is stored in the registry. Unfortunately it is stored as a  sequence of null-terminated strings which I could not figure out how to represent in a batch file. This little snippet of VBScript code may help:

Code: [Select]
' List the documents in the Word MRU registry key
'
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
strKeyPath = "Software\Microsoft\Office\11.0\Common\Open Find\Microsoft Word\Settings\Save As\File Name MRU"
strValueName = "Value"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
  strComputer & "\root\default:StdRegProv")
 
oReg.GetMultiStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, arrValues

If Right(LCase(WScript.FullName), 11) = "cscript.exe" Then
For Each strValue In arrValues
WScript.Echo "Document - " & strValue
Next
Else
For Each strValue In arrValues
strBlock =  strBlock & "Document - " & strValue & vbCrLf
Next
WScript.Echo strBlock
End If

Save the script with a VBS extension. It can be run from the command prompt as cscript scriptname.vbs or wscript scriptname.vbs If run with the former, output will be directed to the console as a list of documents. If run with the latter, outout will be a single window with all the documents listed. To produce a hardcopy, use cscript and redirect the output to your printer Ex: cscript scriptname.vbs > lpt1 .

Note: I'm still using Word XP (2002) so I got the Word 2003 registry key from the internet. With any luck it is correct. In any case, the registry is used only for reading, so there is no danger of mucking it up.

Good luck.  8)


Uhmm this looks complex for me. Is there any simpler explanation? Thanks.
Title: Re: print record of minimized Word documents?
Post by: Sidewinder on November 10, 2010, 03:45:30 PM
Wow! This is your lucky day. Today, and today only, explanations are just 5¢ and simpler explanations are just 7¢. As usual the script is free.

Quote
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
strKeyPath = "Software\Microsoft\Office\11.0\Common\Open Find\Microsoft Word\Settings\Save As\File Name MRU"
strValueName = "Value"

Assigns the registry key to various variables. The registry key is specific to Word 2003 and will be different for other versions. Also designates the local computer to do the processing.

Quote
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
  strComputer & "\root\default:StdRegProv")
 
oReg.GetMultiStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, arrValues

This is the heart of the script. Connects to the WMI class which contains the properties and methods needed to access the Windows registry. The MRU is a sequence of null-terminated strings, which the GetMultiStringValue returns as an array. Arrays are easy to process in VBScript, a registry sequence of null-terminated strings not so much.

Quote
If arrValues(0) = "" Then
   WScript.Echo "MRU List Is Empty"
   WScript.Quit
End If

If the MRU is empty, this error trap will allow for a gentle landing instead of the script crashing into the side of a mountain. Well maybe not so dramatic, but if you have an empty MRU you'll see the results from this code.

Quote
If Right(LCase(WScript.FullName), 11) = "cscript.exe" Then
   For Each strValue In arrValues
      WScript.Echo "Document - " & strValue
   Next
Else
   For Each strValue In arrValues
      strBlock =  strBlock & "Document - " & strValue & vbCrLf
   Next
   WScript.Echo strBlock
End If

This code formats the output returned in the array of MRU items. It queries which interpreter is being used (VBScript has two) and takes advantage of how the echo instruction works in each.

And there you have it. Please pay the cashier on your way out.

Good luck.  8)