Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBA Code return value in Excel

Hello, I am trying to run the following code to return the serial number of
the hard drive i.e. a unique identifier . is it possible to amend this code
to return the serial number as a value in a particular excel cell?

Thanks very much for your help

Sub SerialNumber()
Dim oFSO As Object
Dim drive As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drive = oFSO.GetDrive("C:\")
MsgBox drive.SerialNumber

Set oFSO = Nothing
Set drive = Nothing
'release memory

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default VBA Code return value in Excel

not sure from your question if this is what you want or not

Sub SerialNumber()
Dim oFSO As Object
Dim drive As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drive = oFSO.GetDrive("S:\")
Worksheets("Sheet1").Range("A1").Value = "'" & drive.SerialNumber

Set oFSO = Nothing
Set drive = Nothing
'release memory

End Sub

--


Gary


"Blair" wrote in message
...
Hello, I am trying to run the following code to return the serial number of
the hard drive i.e. a unique identifier . is it possible to amend this code
to return the serial number as a value in a particular excel cell?

Thanks very much for your help

Sub SerialNumber()
Dim oFSO As Object
Dim drive As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drive = oFSO.GetDrive("C:\")
MsgBox drive.SerialNumber

Set oFSO = Nothing
Set drive = Nothing
'release memory

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBA Code return value in Excel

Yes this is exactly what I wanted. Thank you for your help.

"Gary Keramidas" wrote:

not sure from your question if this is what you want or not

Sub SerialNumber()
Dim oFSO As Object
Dim drive As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drive = oFSO.GetDrive("S:\")
Worksheets("Sheet1").Range("A1").Value = "'" & drive.SerialNumber

Set oFSO = Nothing
Set drive = Nothing
'release memory

End Sub

--


Gary


"Blair" wrote in message
...
Hello, I am trying to run the following code to return the serial number of
the hard drive i.e. a unique identifier . is it possible to amend this code
to return the serial number as a value in a particular excel cell?

Thanks very much for your help

Sub SerialNumber()
Dim oFSO As Object
Dim drive As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drive = oFSO.GetDrive("C:\")
MsgBox drive.SerialNumber

Set oFSO = Nothing
Set drive = Nothing
'release memory

End Sub




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
Getting Excel to return Hiragana using code/char functions Kuroishi Excel Discussion (Misc queries) 0 January 9th 10 12:39 PM
Outlook Object Model via Excel -- return code after send? gary Excel Programming 1 June 11th 07 02:30 PM
Excel 2002 VBA code to return a page number within a worksheet JCIrish Excel Programming 1 February 19th 06 09:23 PM
How do I code VBA to return information from a web site to an excel workbook Richard Mogy Excel Programming 4 June 1st 05 03:48 PM
Excel return error code Gary Lam Excel Programming 2 August 18th 03 06:19 PM


All times are GMT +1. The time now is 04:37 PM.

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

About Us

"It's about Microsoft Excel"