Openning word doc

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

You need to enclose the document filepathname in quotes.

Cut & paste this line:

Shell ("winword.exe ""\\Melfs004\PublicFolders\A5 - TRF Documents\03 -
Position Profiles\Profiles.doc""")

or do this:

dim sDoc as string
sDoc = "\\Melfs004\PublicFolders\A5 - TRF Documents\03 - Position
Profiles\Profiles.doc"
Shell ("winword.exe """ & sDoc & """")

Within a string, two quotes denotes a single quote. So "A""B" means [one A],
[>one< quote], [one B]. So with either method shown above, this is what is
passed to Shell():

winword.exe "\\Melfs004\PublicFolders\A5 - TRF Documents\03 - Position
Profiles\Profiles.doc"

Then winword will see the second parameter as >one< parameter - not as
five<, which is probably what happens with this:

winword.exe \\Melfs004\PublicFolders\A5 - TRF Documents\03 - Position
Profiles\Profiles.doc
^1 ^2 ^3 etc.

HTH,
TC
 
Hi all
I have a line of code that (should) open a word doc:
Shell ("winword.exe \\Melfs004\PublicFolders\A5 - TRF
Documents\03 - Position Profiles\Profiles.doc"),
vbNormalFocus

Word opens fine but I get error messages saying that can't
open "Melfs004\PublicFolders\A5.doc" , "TRF
Documents\03.doc" and "Position Profiles\Profiles.doc".
Obviously the hypen in the folder names is causing me
strife. Is there away of getting around this? I've tried
to setting it as a variable. I'm using Access97, Word97
and NT4.
 
Try:

ApplicationFollowhyperlynk "\\Melfs004\PublicFolders\A5 - TRF
Documents\03 - Position Profiles\Profiles.doc"
 
Back
Top