Is there anyway to open a file in an application. So specify the application and then open a file with it?
Thanks
Printable View
Is there anyway to open a file in an application. So specify the application and then open a file with it?
Thanks
Open which file in what type of application?Quote:
Originally Posted by andyb7901
I have a few files without a file association. If I were to open these through explorer i would associate them with a program called xPrint?
So your question is hot to add File Association to a particular type of file using VB 2005? Is that right? You want to do it using the code.
I want to be abale to open a file of my choosing in a specific program using code. So a file named hello (Without any extension) to be opened in xPrint.exe
If xPrint application takes command line arguments and the file that you want to open complies with the format of the xPrint application then you can use ProcessStartInfo class to open a specific file with xPrint application
That is what I have managed to sort of get working. I have it working on a C:\hello\hello ( no file extension) file now. However, when i do it on one of my real files it doesnt seem to like spaces. I have the following file to be read into the xPrint file;
"c:\hello\SUPPLIER NOTIFICATION-3177-0504200747522"
However it only seems to read NOTIFICATION-3177-0504200747522 and not the Supplier bit before that? any reason why?
Code:Dim MyProcess As New Process
MyProcess.StartInfo.FileName = "C:\xPrint\vpxPrint.exe"
MyProcess.StartInfo.Arguments = "c:\hello\SUPPLIER NOTIFICATION-3177-0504200747522"
MyProcess.Start()
How about trying it this way?vb Code:
Dim MyProcess As New Process MyProcess.StartInfo.FileName = "C:\xPrint\vpxPrint.exe" MyProcess.StartInfo.Arguments = """c:\hello\SUPPLIER NOTIFICATION-3177-0504200747522""" MyProcess.Start()
Perfecto!!! Works like a treat! Thanks for all your help!