Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Determine drive

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Determine drive

Double-click My Computer
--
Gary''s Student - gsnu200767
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Determine drive

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Determine drive

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Determine drive

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Determine drive

"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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Links to mapped drive change to refer to local hard drive SueD Links and Linking in Excel 1 May 8th 08 11:42 AM
Import from MS Access - Lose the drive letter..link only to drive Cyhill Excel Programming 6 September 17th 07 06:42 PM
Determine the USB drive Michael Singmin Excel Programming 9 March 14th 06 08:40 PM
Windows API to Determine if File is Local/Convert Path to Drive Letter Johnny[_10_] Excel Programming 0 March 10th 06 01:20 PM
Determine cells that drive conditional formatting? Nicolle K. Excel Discussion (Misc queries) 2 January 7th 05 01:08 AM


All times are GMT +1. The time now is 05:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"