View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How To Convert Thousands of Works 7.0 Files to Word 2007 Simultaneously

The macro is simply a generic batch processing function that works at an
individual folder level, using built-in dialogs to enable the user to select
the folder. It opens each file in the folder that matches the search string
(here *.wps) and saves those documents as Word docx format.
It has no ability to search across a range of folders.

Because only you know what files you have on your hard drive and the lack of
error trapping in the macro, it is not a good idea to include code to delete
the wps files. It would be a simple job to search for them later with
Windows Explorer and delete them, when you are sure that they have all been
converted. However if you really want to take that approach change the
section from While ... to ... Wend with

While Len(strFileName) 0
Set oDoc = Documents.Open(strPath & strFileName)
oDoc.Convert
oDoc.Close SaveChanges:=wdSaveChanges
strFileName = Dir$()
Wend

This will convert the documents and delete the originals in the process.

I don't have the code to hand to iterate through all the possible sub
folders, but if you wish to pursue this, then ask in the Word vba
programming forum.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





Jeffrey L. Hook wrote:
**EXCELLENT**, Graham! THANKS!

1. If you have the appropriate filter installed, Word will open
Works documents without problem.

Yes, I can do that easily. I can open every one of the 20K Works
7.0 documents in Word 2007 instantly. That's never been a problem.

2. A sensible option would be open the Works files as you require
them and save them as Word 2007 documents...

I can also do that, but, as I explained, I've had such difficulty
with Works
7.0's "word processor" that I want to be rid of the application and
I'd rather convert all of its existing files to Word 2007 now, so I
can avoid future use of the Works application. (I do appreciate
Works' flat-file database.)

Some users who find this thread in the future may wish to know how
they can find and then convert all files of a type. I'll explain
several methods below my signature.

3. The following macro will save all Works documents as Word docx
format from a given folder. The original Works documents are
unaffected, so you can return to the original if necessary...

Thanks very much for the code. Please understand that my knowledge of
macros in Word 2007 and of Visual Basic is just about nil. The simple
"Convert-Save-Close" macro which I mentioned in my first message was
my first macro. (This functionality isn't "supported" by Works' "word
processor" so I had no prior experience of macros.)

Here's the entirety of my first macro, from the Visual Basic GUI:

***
Sub Macro3()
'
' Macro3
' Automates the steps of the Conversion process within a Works 7.0
"word processing" file which has already been opened in Word 2007.
'
ActiveDocument.Convert
ActiveDocument.Save
ActiveWindow.Close
End Sub

***

That's all there is, but it seems to work.

I was able to install your macro. I could see from the code that the
macro seemed to be focused on folders, and that seemed appropriate,
because I hoped it would start at the "highest" folder in a given
file path (closest to the root) and would "work its way to the end of
the path." I assigned a Quick Access Toolbar button to the macro and
I then ran it, on a "low-stakes" folder of content which I rarely
use. (I should have copied a folder and run the macro on the copy,
in case I bungled the installation and problems resulted, but I guess
I could restore content from a back-up of my data directory if that
were necessary.)

I see that your macro displays a typical Windows browse-type dialog
which is titled "Select folder and click OK." I assumed I should use
the dialog's browse capability to navigate to a folder in which I
wish to convert Works documents and I assumed I should then
left-click the dialog's "OK" button. The dialog doesn't offer any
display of content (i.e. of files in folders) unlike the Word 2007
"Open" dialog, which can be set to show "All Files (*.*)" in its
"Files of type" field. Also, if I select a folder and then click
"OK" the folder name doesn't appear in the macro's "Folder name"
field, which remains empty, although I see that the field's drop-down
list shows all folders in which I've used this macro, in reverse
chronological order. These folders are only shown *after* the
macro's been run in them.

I'm "operating blind" with this macro because I can't see if any
folder contains any files which I wish to convert. I could navigate
simultaneously in Windows Explorer in order to locate Works 7.0
documents which I wish to convert while I also perform the same
navigation in your macro, but I don't want to *double* my navigation!
It's easier simply to open any Word 2007 file and then to navigate in
that file's Open dialog via the file's Office menu, with the Open
dialogue set to Files of all types, so I can see the contents of all
folders but it's even easier than *that* for me to use my desktop
search engine (Dave Vest's FileLocator Pro) in order to obtain a list
of *ALL* Works 7.0 documents in any directory. That completely
eliminates all navigation! As I explained in my first message I can
reduce the amount of time which is required for each conversion to a
few seconds by combining my desktop search engine with my own "quick
and dirty" macro, but I still feel like it's a waste of time to
convert files "one at a time" like this, even if each conversion only
requires seconds. I'm looking for a way to automate the conversion
of more than 20,000 files and to perform those conversions in as
little time as possible.

Your macro seems to operate only in one folder (at one "level" of a
hierarchy) at a time. It doesn't seem to "drill down" along file
paths and to work in all sub-folders. When I could see in its code
that it was focused on folders I decided to operate it close to the
end of a rarely-used file path in order to reduce the chance that it
might do damage if I'd installed it incorrectly and if I'd
"corrupted" it. I operated it a few levels above the end of the test
path in the hope that it would convert all files in all sub-folders,
but it never left the folder in which it was first operated. It
therefore doesn't operate in the way which I desired. It also
retains the original Works 7.0 files although I'd prefer to use Word
2007's "Convert" option, which deletes the original files, and which
leaves only the newly-converted Word 2007 files.

Are you at all inclined to modifiy the code in order to assure that
the macro will:

1. move along complete file paths, working in all sub-folders and
will

2. convert all Works documents in all folders, deleting the original
files, and leaving only the newly-converted Word 2007 files, as
results from the use of Word 2007's "Office\Convert" menu?

Would you be willing to explain how your code limits this macro's
function in these respects, so I could try to modify the code myself?
I tried to change "False" to "True" in this context:

...With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = True...

but that didn't produce the sub-folder effect which I'd hoped to
produce.


Jeff Hook, NJ, USA (Additional comments below may be of interest to
users who wonder how to locate and convert files of any type.)

I've used these different methods to locate Works 7.0 files and to
convert them to Word 2007. I've written an extremely simple macro in
Word 2007 which merely automates the four-click process of opening
each file's Office menu when the Works file is opened in Word 2007,
left-clicking the "Convert" command in the Office menu, left-clicking
the "Save" button on the Quick Access Toolbar, and then left-clicking
the Windows "Close" button at the upper-right corner of each file's
GUI. I installed my macro as a button on the Quick Access Toolbar so
it appears in each file when each file is opened in Word 2007.
Conversion is therefore a simple matter of opening each file in Word
2007 and then making a single left-click on the macro's button. The
macro does the rest:

A. I can open each Works 7.0 file individually in Word 2007 by
right-clicking the file in the Contents Pane of Windows Explorer in
the Windows Classic View in Windows XP, then left-clicking "Open
With\Microsoft Office Word" in the context/"pop-up" menu.

B. From within any Word 2007 file, I can use the Word 2007 Open
command in the Office menu. This produces the Open dialog, in which
I can navigate to the desired Works 7.0 files, which I'll be able to
see in the dialog's Browse display if I've set the dialog's "Files of
type" field to "All Files (*.*)" in the field's drop-down list.

If I leave any Word 2007 file open after I've navigated to my first
Works
7.0 file and have converted that file to Word 2007 the Open dialog
will remain "set" to the last folder in which I worked. This helps
me to navigate through directories in order to convert multiple files
one-by-one. If I close all Word 2007 files, it'll be necessary to
"re-set" the "Open" dialog from the system root, by navigating once
again to the desired folders.

C. A convenient way of converting all files systematically (but
still only one-by-one) is to use a desktop search engine to obtain a
list of all files of a given type in a given directory, as I
explained in my first message. I can then convert each file in the
search engine's "search results" list, by using each file's context
menu, as I explained here in method "A" above. This method's helpful
because it obviates navigating through the directory in search of the
files which are to be converted; the engine lists them all and it's
not necessary to look for them.

JLH

"Graham Mayor" wrote in message
...
If you have the appropriate filter installed, Word will open Works
documents without problem. You can download the older Works filters
from my web site. The latest filter is supplied with Office 2007.
(snipped)