Attaching cells to word documents

  • Thread starter Thread starter pgoodale
  • Start date Start date
P

pgoodale

I have a large excel spreadsheet. Within the spreadsheet are references
to word documents. These word documents are all stored in the same
folder. The only difference between what the word documents are called,
is a number, i.e. WORD123, WORD537, etc. I wish to make a link within
the excel spreadsheet to these word documents. I know I could use
hyperlinks to do this, however there are a vast quantity of links that
I wish to make and it would take too long to do it this way. If I use a
macro could I write a code to automatically find these word documents.
Any help is really appreciated. Thanks.
 
You can use the filesearch object to search the directory for "Word.doc"
and I believe it will retrieve a list of these files with their path.

See help on the filesearch object.
 
pgoodale,

You could try something like this:

Dim appWD As Word.Application
'Set-up appWD
Set appWD = CreateObject("Word.Application.9") 'Open
M.S. Word 2000
appWD.ChangeFileOpenDirectory "C:\MywordDocs" 'Word looks
here for file
appWD.Documents.Open Filename="WORD" & Range("A1").Value

Where A1 contains the number of the Word Doc you want to open and all your
docs are in the folder C:\MywordDocs

HTH
Henry
 
Back
Top