ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   recognize USB drive (https://www.excelbanter.com/excel-programming/341611-recognize-usb-drive.html)

lcoreyl[_20_]

recognize USB drive
 

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


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=472292


Gary''s Student

recognize USB drive
 
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.
--
Gary''s Student


"lcoreyl" wrote:


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


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=472292



lcoreyl[_21_]

recognize USB drive
 

Gary''s Student Wrote:
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.
--
Gary''s Student


"lcoreyl" wrote:


Is there a way to see if there is a USB memory stick connected to the

PC
within a macro?


--
lcoreyl

------------------------------------------------------------------------
lcoreyl's Profile:

http://www.excelforum.com/member.php...fo&userid=2042
View this thread:

http://www.excelforum.com/showthread...hreadid=472292



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?


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=472292



All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com