Archive of Mr Excel Message Board
I have a directory called “Notes” (full path below) which contains files for making quick notes on telephone conversations with clients. Each filename is one word name for client. I want to be able to type the name and run a macro which will cut the name, open to the “Notes” directory, paste the name in the “file name” section of the “File Open” dialog box, and open the file.
Tried to record but the macro (see below) always opens the file (“Romain”) I used for recording. Can someone help?
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Cut
ChangeFileOpenDirectory "\\EVA001\#114008\Docmnts\CUSTOMER\Notes\"
Documents.Open FileName:="romain.doc", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto

Dim fileName as String
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
fileName = Selection.Value
ChangeFileOpenDirectory "\\EVA001\#114008\Docmnts\CUSTOMER\Notes\"
Documents.Open FileName:="" & fileName & ".doc", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto


See what that does.

