I am trying to write code to write a record to an Access database on my hard
drive for each file that has been backed up to a CD or DVD.
Each record should contain the following:
Name of file
Path to the file on the DVD or CD
Size of the file
Date of the file
Name of the media which I assigned when the media was burned,
e.g. "DiskNbr0294"
The name of the media is what is displayed in the left pane of Windows
Explorer for the content of the "My Computer" folder
The methods "CreateObject", "GetDrive", and "GetDriveName" would seem to be
what is needed to get the name of the media. So, I tried the following:
Project references assigned are:
Visual Basic for Applications
Visual Basic runtime objects and Procedures
Visual Basic objects and procedures
Ole Automation
Mcirosoft ActiveX Data Objects Recordset 2.8 Library
Microsoft ActiveX Dat Objects 2.8 Library
Microsoft Scripting Runtime
Microsoft Script Control 1.0
Microsoft Scriptlet Library
Microsoft WMI Scripting V1.2 Library
Dim oFileSystemObject As Object
Dim oDrive As Object
Dim oDriveName As Object
Dim sDriveName As String
Set oFileSystemObject = CreateObject("scripting.filesystemobject")
Set oDrive = oFileSystemObject.getdrive("d:") 'Should return drive object
for path d:
'Help syntax above is object.GetDrive drivespec
'Where object is a file system object
sDriveName = oDrive.getdrivename("d:")
sDriveName = oFileSystemObject.getdrivename("d:")
'Help syntax above is object.GetDriveName(path)
'where object is FileSystemObject
oDrive displays "D:" when the mouse cursor is put on it.
The first assign of sDriveName fails with "Object Doesn't Support this
property or method."
The second assign of sDriveName simply sets it = "d:"
So, the name which I assigned to the CD/DVD media volume seems to be some
other attribute than what I can find in the VB reference.
Thank you for kind help.
--
Lamont Phemister
Archived from group: microsoft>public>vb>syntax