Sheel Command

G

Guest

I am having problem getting the shell command to work. I am trying to get it
open a file in it respective application.

I am running MS Access 2003.

My code looks like this

Dim RetVal
RetVal = Shell(strOpenDocument, 1)

' strOpenDocument is a public variable which provides the full path and
file name.
' example = "C:\My Documents\Test.doc"
 
G

Guest

To open a word file or any other file, try and use FollowHyperlink instead of
the shell command

dim strDocToOpen as string

strDocToOpen = "C:\My Documents\Test.doc"
application.FollowHyperlink strExcelToOpen

When you run the shell, you need specify which application you want to run,
to open the document, the FollowHyperlink will run the default of windows.
 
G

Guest

That worked great.

Thank you!

Is there a way to surpress the Microsoft message about possible viruses that
comes up.

Dwight
 
G

Guest

I'm hapy it works.

No sorry, mybe you can start a new post asking the new question.
Or ask the Anti Virus company you are using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top