recognize USB drive

L

lcoreyl

Is there a way to see if there is a USB memory stick connected to the PC
within a macro?
 
G

Gary''s Student

Yes. create a small .bat file that attempts to do a DIR to the logical drive
unit. Run the .bat file thru a SHELL command from VBA. If you get back the
standard error message that the system could not find the path specified,
then the drive is not connected.
 
L

lcoreyl

Gary''s Student said:
Yes. create a small .bat file that attempts to do a DIR to the logical
drive
unit. Run the .bat file thru a SHELL command from VBA. If you get
back the
standard error message that the system could not find the path
specified,
then the drive is not connected.

That won't work as different users will have different drive letters.
Is there a way to use the DIR function to find out what drives exist?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top