Opening files with macros

hojkoff

Registered User.
Local time
Today, 20:59
Joined
Sep 1, 2009
Messages
16
Hi all, 1st post so I hope that I don't screw this up!

I'm trying to get access to open a related pdf file when you click on a lable in a forum, but I can't seem to get it to locate the file correctly.

So far I can get this to work,

Private Sub Text0_Click()
Dim acrobatApp As String

acrobatApp = "C:\Documents and Settings\***\Desktop\TEST.txt"
'test
Shell "winword.exe TEST.txt"
End Sub

Which works great to open Word and then the file TEST.txt however, as soon as I try to open a file with is not stored in the same location as the database it all goes pear shapped and it won't locate the file.

My ultiamte aim is to get the shell comand to open a pdf which is stored in the acrobatApp string.

I'm not even sure that the shell comand is the right comand to be using!

Any thoughts?
 
Shell is the right one, as that is what you use to start an outside app.

Shell "winword.exe " & Variable
Will start the app with your variable... You have to keep in mind that you run into problems with paths that have spaces and special characters in them. You need to enclose those path's with "" to get the right effect.
Spaces are parameter seperators for most apps (like word)

Good luck ! And post back if you need more help :)
 

Users who are viewing this thread

Back
Top Bottom