Jump to content

Program Open File


 Share

Recommended Posts

I haven't the fondest as to what I should search for so I'll post and see what I can get.

Is there a function that will take a program and open a file. Like if I wanted to open a document for microsoft office it would be something like ProgramOpenFile(title - "microsoft office", text "", File to open "stuffnjunk.doc"). Or is Controlsend an "alt f o" then ControlSetText "the filename/path" the only way to do that?

Thanks in advance.

Link to comment
Share on other sites

Usually, those programs accept commandline parameters which can also be used for opening files.

Have you tried:

$officepath = 'C:\Program Files\Microsoft Office\Office12\" ;whatever the path to MS word is
$docfile = "test.doc" ;file you want opened
Run($officepath & "winword.exe " & $docfile)

EDIT: If you are looking for UDFs for Word or Excel, check the _Word* or _Excel* functions in the help file. As for other programs, not everything has a UDF of function, most specially the ones you normally do via commandline arguments.

Edited by omikron48
Link to comment
Share on other sites

Usually, those programs accept commandline parameters which can also be used for opening files.

Have you tried:

$officepath = 'C:\Program Files\Microsoft Office\Office12\" ;whatever the path to MS word is
$docfile = "test.doc" ;file you want opened
Run($officepath & "winword.exe " & $docfile)

Ok yeah that would be pretty simple. If all else fails I will definitely use that. Thanks!

Would that work if the program was already running?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...