Sign in to follow this  
Followers 0
mark2004

How to open a file with code

5 posts in this topic

I would like to be able to use code to open a generic file, i.e. a word document or image file. Just as if you double-clicked

it from windows explorer.

I can use the FileOpenDialog to obtain the file's path but how do I open it?? I know this one has to be dead simple......

Mark

Share this post


Link to post
Share on other sites



ShellExecute in the newest version would be what you're searching for. You could manage to

do some fiddling with Run and make it work using that as well, but ShellExecute is the easiest

and best way to go.

Share this post


Link to post
Share on other sites

Thanks Helge. I tried using the Run function and just putting in the filename "manual.doc" and it didn't work. I didn't know how

else to fiddle with Run. I haven't downloaded the latest version so I'll do that first and give ShellExecute a go.

Share this post


Link to post
Share on other sites

you have to put the whole path and the filename to make it work it you just put manual.doc it will assume is in the windows directory

Share this post


Link to post
Share on other sites

you have to put the whole path and the filename to make it work it you just put manual.doc it will assume is in the windows directory

If you're referring to mark2004's attempt of using Run with *.doc files, you don't think it has something to

do with the fact that a Word document isn't a executable file and because it's not listed as a supported file-

type for Run ? It's not just a matter of putting the whole path as you say...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0