469,915 Members | 2,635 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,915 developers. It's quick & easy.

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 7872
"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
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.