472,119 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

How to invoke system command from VBA?

Hi,

I just need to do something simple like

dir > dir.txt

from Access. In C I could simply do

system("dir > dir.txt");

or specify the desired command as a string but I couldn't locate anything
similar for VBA. Does anyone know this off top of their head? Essentially I
want to open another application by clicking a button on an Access form.

Thanks!
Nov 12 '05 #1
2 7969
"Kenmlin" <ke*****@aol.com> wrote in message
news:20***************************@mb-m06.aol.com...
Hi,

I just need to do something simple like

dir > dir.txt

from Access. In C I could simply do

system("dir > dir.txt");

or specify the desired command as a string but I couldn't locate anything
similar for VBA. Does anyone know this off top of their head? Essentially I
want to open another application by clicking a button on an Access form.


Shell "dir > dir.txt"

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #2
On 11 Apr 2004 15:52:39 GMT, Kenmlin wrote:
dir > dir.txt

from Access. In C I could simply do

system("dir > dir.txt");


If it's just about opening another application, next to "shell" you can use
"FollowHyperlink" on the document name.

If you want to execute the dir command, this syntax is better:

Shell Environ$("COMSPEC") & " /c dir > c:\dir.txt"

Peter

--
No mails please.
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by AznCollegeGuy | last post: by
7 posts views Thread by DB_2 | last post: by
7 posts views Thread by Jeff Stewart | last post: by
7 posts views Thread by stephan querengaesser | last post: by
2 posts views Thread by Glenn Venzke | last post: by
5 posts views Thread by Lou Pecora | last post: by
2 posts views Thread by =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post: by
3 posts views Thread by Only-Trouble | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.