Running Outside Programs From Access

  • Thread starter Thread starter FpwL1399
  • Start date Start date
F

FpwL1399

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.
 
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
 
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
 
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".
 
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,


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
 
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
 
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
 
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.
 
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.
 
Back
Top