By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

How to invoke system command from VBA?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
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.