Re: Sample Macros (Word 6 -> Word 97) - processing multiple files

Subject: Re: Sample Macros (Word 6 -> Word 97) - processing multiple files
From: Beth Friedman <bjf -at- WAVEFRONT -dot- COM>
Date: Mon, 8 Sep 1997 15:48:45 -0500

In our previous episode, JIMCHEVAL -at- AOL -dot- COM said:
>
> Here's some more sample code for Word 97 macros. It's also an invitation to
> help, since the Word 97 version isn't as tight as I'd like it (see comments
> below.)

Great minds think alike, or something like that. I just finished a
Word 95 (Word 7.0) macro that accesses every file in a specified
directory (including subdirectories) and inserts file name (with
path), author, creation date, and last changed date in a separate
document. I would have liked to have included title as well, but a
number of those include tabs, and the CleanString command doesn't get
rid of tabs, so it was easier to leave them out.

Here's the code:

Sub MAIN
On Error Resume Next
FileOpen "f:\actlist.doc" 'This is the ongoing "active list" document
'It must already be created for the macro to run properly

FileFind .Name = "*.DOC", .SearchPath = "g:\pas\01_std", .Options = 0,
.SortBy = 4, .SubDir = 1, .ShowFolders = 0
numfilesfound = CountFoundFiles()
FormatFont .Points = 10

For count = 1 To numfilesfound
FileNme$ = FoundFileName$(count)
FileOpen(FileNme$)
Dim dlg2 As FileSummaryInfo
GetCurValues dlg2
Author$ = dlg2.Author
Create$ = Left$(dlg2.CreateDate, 8)
LastSave$ = Left$(dlg2.LastSavedDate, 8)
FileClose 2
If count <> 1 Then InsertPara
Insert LCase$(FileNme$)
Insert Chr$(9)
Insert Author$
Insert Chr$(9)
Insert Create$
Insert Chr$(9)
Insert LastSave$
Next
End Sub

Back when I first developed a variant of this macro for Word 2.0, it
was much more complicated, because Word didn't allocate enough memory
for macros, and it choked after about 75 documents. I had to write
something that would stop every 50 documents, let me save and close
Word, then open Word and resume from where it left off. This macro
made it through 3,500 documents in Word 7.0 without a glitch.

*********************************************************************
Beth Friedman bjf -at- wavefront -dot- com
"What happened to the kippers left from breakfast?
Or maybe there's a bit of cold roast pheasant.
I am the king now, and I want a sandwich." -- John M. Ford

TECHWR-L (Technical Communication) List Information: To send a message
to 2500+ readers, e-mail to TECHWR-L -at- LISTSERV -dot- OKSTATE -dot- EDU -dot- Send commands
to LISTSERV -at- LISTSERV -dot- OKSTATE -dot- EDU (e.g. HELP or SIGNOFF TECHWR-L).
Search the archives at http://www.documentation.com/ or search and
browse the archives at http://listserv.okstate.edu/archives/techwr-l.html


Previous by Author: Re: word97 section breaks
Next by Author: Help with PowerPoint macro
Previous by Thread: Sample Macros (Word 6 -> Word 97) - processing multiple files
Next by Thread: Contract - Ft. Worth Technical Writer


What this post helpful? Share it with friends and colleagues:


Sponsored Ads