Professional Documents
Culture Documents
=============================
'- READ .MP3 & .WMA FILE PROPERTIES TO A WORKSHEET
'===============================================================================
=============================
'- MACRO TO :'- *1. SELECT A FOLDER - *2. CLEAR THE ACTIVE WORKSHEET* - *3. READ .MP3 & .W
MA EXTENDED FILE PROPERTIES*
'- *3. MAKES PROPERTY CELLS BLUE
'- ONLY EXTRACTS FILE DATA SO CAN BE USED ON ITS OWN. SHEETS CAN BE SAVED AS NOR
MAL
'- CAN THEN RUN MACRO "WRITE_TO_EXPLORER" (in another module below) TO *CHANGE*
PROPERTIES
'- Uses Windows Shell32.dll (Requires Tools/References .. 'Microsoft Shell Contr
ols And Automation')
'- Brian Baulsom July 2007 - using Excel 2000/Windows XP
' ==============================================================================
============================
'- Method (works on all files in a single folder)
'- 1. Run macro "READ_FROM_EXPLORER" below TO GET FILE NAMES INTO CURRENTLY ACTI
VE WORKSHEET
'- 2. Manually amend file details in the worksheet.Delete or hide rows for files
not changed saves time(can be left)
'- 3. Run macro "WRITE_TO_EXPLORER" (other module)
'===============================================================================
============================
Option Base 1
' MyProperties(15) starts 1 instead of 0
Dim MyFilePathName As String
' Local variable full path & file name
Public MyPathName As String
' **Public variable
|enables 'Sub GetPat
hFileNameFromFullPath()'|
Public MyFileName As String
' **Public variable
|usage in 'WRITE_TO_
EXPLORER' macro
|
'- Properties Array (list of integers)
Dim Arr1 As Variant
' "Name"= shell property zero + First 5 prop
erties in Windows Explorer
Dim Arr2 As Variant
' some more shell GetDetailsOf() property nu
mbers (0-34 available. 3 unused)
Dim MyProperties(16) As Integer
' Shell property index numbers used here. Pu
ts them in required order
Dim MyPropertyNum As Integer
' Array item position 1-15
Dim MyPropertyVal As Variant
' Lookup Array data shell property numbers 0
,16, 17 ... etc.
'Dim ws As Worksheet
Dim ToRow As Long
' write to worksheet row number
'- Shell variables
Dim ShellObj As Shell
Dim MyFolder As Folder
Dim MyFolderItem As FolderItem
''===============================================================================
============================
'- MAIN ROUTINE
'===============================================================================
============================
Sub READ_FROM_EXPLORER()
Application.EnableEvents = False
' WORKSHEET Worksheet_Change() makes cha
nged cells yellow
'------------------------------------------------------------------------------------------------------
================
'- SUB TO SEPARATE PATH & FILE NAME FROM FULL NAME
'- puts to Public module level variables 'MyFileName' & 'MyPathName'
'===============================================================================
================
Public Sub GetPathFileNameFromFullPath(Nm As String)
For c = Len(Nm) To 1 Step -1
If Mid(Nm, c, 1) = "\" Then
MyFileName = Right(Nm, Len(Nm) - c)
MyPathName = Left(Nm, Len(Nm) - Len(MyFileName) - 1)
Exit Sub
End If
Next
End Sub
'---------------------------------------------------------------------------------------------