MS Access Forum / Forms Programming / June 2006
Running Outside Programs From Access
|
|
Thread rating:  |
FpwL1399@gmail.com - 26 May 2006 16:19 GMT I need to figure out a way to run a macros in Access that will open another program and bring in a certain file. Is there a way to do this? I'm struggling.
Michel Walsh - 29 May 2006 12:20 GMT Hi,
You can use the function SHELL() to start another application "as it does" when you type in the RunAs...
You can use Automation, if supported, to not only launch but control the application, and what it should do.
Hoping it may help, Vanderghast, Access MVP
>I need to figure out a way to run a macros in Access that will open > another program and bring in a certain file. Is there a way to do > this? I'm struggling. FpwL1399@gmail.com - 13 Jun 2006 00:34 GMT How would I use that automation function, and how do I find out if it's supported.
> Hi, > [quoted text clipped - 10 lines] > > another program and bring in a certain file. Is there a way to do > > this? I'm struggling. Michel Walsh - 13 Jun 2006 22:12 GMT Hi,
If the application supports automation, it surely comes with instructions about how to interact with the VBA object that will be the "application". Not all applications support automation, but in general, if you can use VBA with it, it probably supports automation. As examples, MS Word, Access, Excel, Outlook, Map Point, AutoCAD, are applications that supports automation, while Outlook Express, Notepad, are two applications that do not.
Hoping it may help, Vanderghast, Access MVP
> How would I use that automation function, and how do I find out if it's > supported. [quoted text clipped - 14 lines] >> > another program and bring in a certain file. Is there a way to do >> > this? I'm struggling. Sam Hobbs - 15 Jun 2006 18:06 GMT I don't see anything saying that automation is needed, and if it is not needed then it is likely to not work for the intended purpose. There are many programs that can be executed (indirectly) from VBA without any Automation.
> Hi, > [quoted text clipped - 27 lines] >>> > another program and bring in a certain file. Is there a way to do >>> > this? I'm struggling. Michel Walsh - 15 Jun 2006 23:04 GMT Hi,
Without automation, you can lunch the program, and that is about it, unless you assume that sending messages through a socket, through Windows messages queue, or through... SendKeys... is applicable. To lunch a program, you can use Shell, as I mentioned earlier, but once lunched, without automation, it is not necessary an easy task to control the lunched application. As example, how would you force Notepad to open a specific file name, to insert a new paragraph at the beginning, and to save the file into another specific file name, without relaying on the user to do anything. All that is doable in MS Word, with automation, since you don't only lunch, but control the application.
So, in the end, depends on what you really want to do, indeed, and what the application you lunch expose to your VBA code.
Vanderghast, Access MVP
>I don't see anything saying that automation is needed, and if it is not >needed then it is likely to not work for the intended purpose. There are [quoted text clipped - 33 lines] >>>> > another program and bring in a certain file. Is there a way to do >>>> > this? I'm struggling. Sam Hobbs - 18 Jun 2006 17:13 GMT I think you are saying essentially what I said, except I am not aware of a way to do as much as you say can be done. More specifically, I don't know a way to "launch" (not "lunch") a program such as Notepad using Automation. I doubt it is possible, since Windows needs a progid to get a GUID to know what to execute.
> Hi, > [quoted text clipped - 51 lines] >>>>> > another program and bring in a certain file. Is there a way to do >>>>> > this? I'm struggling. Michel Walsh - 15 Jun 2006 23:11 GMT Hi,
From your other reply, I see you don't have the starting thread. Indeed, using Shell() has been proposed and since the OP didn't find it useful, but explicitly asked for more info about Automation, so does it explain better the answer I made?
Vanderghast, Access MVP
>I don't see anything saying that automation is needed, and if it is not >needed then it is likely to not work for the intended purpose. There are [quoted text clipped - 33 lines] >>>> > another program and bring in a certain file. Is there a way to do >>>> > this? I'm struggling. FpwL1399@gmail.com - 16 Jun 2006 22:04 GMT To all that have replied;
Thanks for all your help, it has been useful. I am using Northwestern Analytical's Quality Analyst, and I have figured out how to write and execute .run automation files from that program. This solves all my problems that I have been having. So thank you all for your efforts. It's been great.
FpwL
> Hi, > [quoted text clipped - 42 lines] > >>>> > another program and bring in a certain file. Is there a way to do > >>>> > this? I'm struggling. Sam Hobbs - 18 Jun 2006 17:17 GMT Thank you.
I made my comments about not using Automation since I did see the initial question, or at least thought I did. If I did see the original question, then Automation was not mentioned. Your comments are consistent with that. So this was another example of the initial question being incomplete.
Based on the final comments of the person that asked the question, obviously Automation is the solution.
> Hi, > [quoted text clipped - 42 lines] >>>>> > another program and bring in a certain file. Is there a way to do >>>>> > this? I'm struggling. Sam Hobbs - 15 Jun 2006 18:00 GMT I don't have your original question to reply to so I am replying to this.
I don't understand "bring in a certain file". That is very vague and probably depends on what the other program does, which I don't know anything about.
One way that probably would help is to use WMI. You can ask about that and other possible solutions in a newsgroup for scripting. There is a newsgroup for WMI specifically, but there are other ways to execute other programs.
You probably just need to look at the Scripting area of TechNet; see:
http://www.microsoft.com/technet/scriptcenter/default.mspx http://www.microsoft.com/technet/scriptcenter/guide/default.mspx?mfr=true http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_grmi.mspx?mfr=true
The last one above is for the "WshShell Object", which has a sutopic "Running Programs" but I can't get a link for that page.
If you need any more help with scripting, you will probably get better help in a scripting newsgroup. If you do post a new question, it will help immensely to be more specific about "bring in a certain file".
> How would I use that automation function, and how do I find out if it's > supported. [quoted text clipped - 14 lines] >> > another program and bring in a certain file. Is there a way to do >> > this? I'm struggling.
|
|
|