PC Review


Reply
Thread Tools Rate Thread

Determine drive

 
 
WLMPilot
Guest
Posts: n/a
 
      1st Feb 2008
Is there a way to determine what drive is assigned to my memory stick.
Instead of having to "explore", then drag and drop my spreadsheets between my
computer and memory stick, I want to use a command button to save it to the
memory stick.

Thanks,
Les
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      1st Feb 2008
Double-click My Computer
--
Gary''s Student - gsnu200767
 
Reply With Quote
 
WLMPilot
Guest
Posts: n/a
 
      1st Feb 2008
Ok, maybe I was not clear enough. I want to know if there is a code in VBA
(Excel) that can automatically determine what drive letter is assigned to the
memory stick so when I click the command button (Caption="Save To Memory
Stick"), it will know what drive to send it to.

Les



"Gary''s Student" wrote:

> Double-click My Computer
> --
> Gary''s Student - gsnu200767

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      1st Feb 2008
See:

http://groups.google.com/group/comp....dbc9d3de889e96

I have not used any of this code.
--
Gary''s Student - gsnu200767


"WLMPilot" wrote:

> Ok, maybe I was not clear enough. I want to know if there is a code in VBA
> (Excel) that can automatically determine what drive letter is assigned to the
> memory stick so when I click the command button (Caption="Save To Memory
> Stick"), it will know what drive to send it to.
>
> Les
>
>
>
> "Gary''s Student" wrote:
>
> > Double-click My Computer
> > --
> > Gary''s Student - gsnu200767

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Feb 2008
You could search the *scripting* newsgroups via google:

I found this post:
http://groups.google.co.uk/group/mic...90dbdfcb919660

That pointed to:
http://groups.google.co.uk/group/mic...9?dmode=source
and
http://groups.google.co.uk/group/mic...2?dmode=source




WLMPilot wrote:
>
> Is there a way to determine what drive is assigned to my memory stick.
> Instead of having to "explore", then drag and drop my spreadsheets between my
> computer and memory stick, I want to use a command button to save it to the
> memory stick.
>
> Thanks,
> Les


--

Dave Peterson
 
Reply With Quote
 
urkec
Guest
Posts: n/a
 
      1st Feb 2008
"Dave Peterson" wrote:

> You could search the *scripting* newsgroups via google:

....
> That pointed to:
> http://groups.google.co.uk/group/mic...9?dmode=source
> and
> http://groups.google.co.uk/group/mic...2?dmode=source
>
>
>
>
> WLMPilot wrote:
> >
> > Is there a way to determine what drive is assigned to my memory stick.
> > Instead of having to "explore", then drag and drop my spreadsheets between my
> > computer and memory stick, I want to use a command button to save it to the
> > memory stick.
> >


I think that sample code does not distinguish between memory sticks and
external disks. Maybe it would be simpler to rename the memory stick (if
possible) and check for volume name, something like this:

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set colDrives = fso.Drives

For Each objDrive In colDrives
If objDrive.IsReady Then
If objDrive.VolumeName = "MYUSBDRIVE" Then
Debug.Print objDrive.Path, _
objDrive.VolumeName, _
objDrive.DriveType
End If
End If
Next

or using WMI:

Set WMI = GetObject _
("WinMgmts:Root\Cimv2")

Set colLogicalDisks = WMI.ExecQuery _
("Select * From Win32_LogicalDisk " & _
"Where VolumeName = 'MyUSBDrive'")

For Each objLogicalDisk In colLogicalDisks
Debug.Print objLogicalDisk.DeviceID, _
objLogicalDisk.VolumeName, _
objLogicalDisk.Description
Next

--
urkec
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Determine the drive letter of BE database... DrGUI Microsoft Access VBA Modules 0 27th May 2010 09:03 PM
Determine if CD/DVD drive is writeable Tim Kelley Microsoft C# .NET 3 27th Nov 2007 12:27 AM
how to determine boot drive? =?Utf-8?B?cmVsYXRpdmVuZXdiaWU=?= Windows XP Setup 8 26th Jun 2007 12:49 AM
Determine the USB drive Michael Singmin Microsoft Excel Programming 9 14th Mar 2006 08:40 PM
How to determine the drive property =?Utf-8?B?ZmNoZW4=?= Windows XP Embedded 2 26th Dec 2004 08:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:46 PM.