#1   Report Post  
Posted to microsoft.public.excel.programming
mrt mrt is offline
external usenet poster
 
Posts: 70
Default Disk id

Hi there,

Has anyone developed some code to obtain the disk id of a given hard disk
(described by the letter)?

Thanks

MrT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Disk id


'---------------------------------------------------------------
Function DiskVolumeId(Drive As String) As String
'---------------------------------------------------------------
Dim sTemp As String
Dim iPos As Long
iPos = InStr(1, Drive, ":")
Drive = IIf(iPos 0, Left(Drive, iPos), Drive & ":")
sTemp = Hex(CreateObject("Scripting.FileSystemObject") _
.Drives.Item(CStr(Drive)).SerialNumber)
DiskVolumeId = Left(sTemp, 4) & "-" & Right(sTemp, 4)
End Function

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"MrT" wrote in message
...
Hi there,

Has anyone developed some code to obtain the disk id of a given hard disk
(described by the letter)?

Thanks

MrT



  #3   Report Post  
Posted to microsoft.public.excel.programming
mrt mrt is offline
external usenet poster
 
Posts: 70
Default Disk id

Thanks! simple and perfect ! Works even when calling it directly with a path!

"Bob Phillips" wrote:


'---------------------------------------------------------------
Function DiskVolumeId(Drive As String) As String
'---------------------------------------------------------------
Dim sTemp As String
Dim iPos As Long
iPos = InStr(1, Drive, ":")
Drive = IIf(iPos 0, Left(Drive, iPos), Drive & ":")
sTemp = Hex(CreateObject("Scripting.FileSystemObject") _
.Drives.Item(CStr(Drive)).SerialNumber)
DiskVolumeId = Left(sTemp, 4) & "-" & Right(sTemp, 4)
End Function

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"MrT" wrote in message
...
Hi there,

Has anyone developed some code to obtain the disk id of a given hard disk
(described by the letter)?

Thanks

MrT




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Disk id

http://support.microsoft.com/kb/291573/en-us
How To Use Visual Basic to List Active Logical Drives

http://support.microsoft.com/default...b;en-us;192689
HOWTO: Get UNC Path From a Mapped Network Share's Drive Letter

maybe places to start.

--
Regards,
Tom Ogilvy


"MrT" wrote:

Hi there,

Has anyone developed some code to obtain the disk id of a given hard disk
(described by the letter)?

Thanks

MrT

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
disk full?? gailmarie Excel Discussion (Misc queries) 3 March 25th 09 07:46 PM
Save a file to disk without re-formating the disk Frustrated Mike Excel Discussion (Misc queries) 2 February 19th 09 07:33 PM
I get a "Disk full" message,what disk? Deputydog New Users to Excel 4 April 10th 08 08:42 PM
Download files from 3.5 disk in excel but system said disk need fo DG Excel Discussion (Misc queries) 0 August 13th 05 04:16 PM
Disk is full Eric Excel Discussion (Misc queries) 0 February 24th 05 02:07 AM


All times are GMT +1. The time now is 09:36 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"