Results 1 to 5 of 5

Thread: Excel H/D Serial Number (resolved)

Threaded View

  1. #1

    Thread Starter
    Lively Member TheFIDDLER's Avatar
    Join Date
    May 2002
    Location
    here and there and far away
    Posts
    126

    Excel H/D Serial Number (resolved)

    I need some help with this. I use this code to get the serial number of my drive. Works well in XP, does not work in 98. I need a code that will work for all windows versions. Any suggestions? This is run by my autoopen subroutine in Excel 97.

    VB Code:
    1. Private Sub snumber()
    2. ' checks serial number of hard disk and stores to name value
    3.     Dim fso, d
    4.     Dim s As Long
    5.     Set fso = CreateObject("Scripting.FileSystemObject")
    6.     Set d = fso.GetDrive(Left(ThisWorkbook.Path, 2))
    7.     s = d.serialnumber
    8.     Names.add Name:="SerialNumber", RefersTo:=Abs(s), Visible:=False
    9.    
    10. End Sub

    Thanks.
    Last edited by TheFIDDLER; May 6th, 2004 at 04:59 PM.
    -----
    #VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP

    I miss my VIC 20.
    Never should have upgraded to my commodore 64. ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width