![]() 'snb, extensive GetDetailsOf and parsing examples, Display Moreĭim pPDF As String, pdfWild As String, rNames As Rangeĭim rFile As Range, rn As Long, cn As Integer 'Debug.Print oList(5), oList.IndexOf("Date accessed", 0), oList.IndexOf("Date", 0), oList.Count 'Debug.Print oList.Count '321 which is 322 names for Windows 10 'Remove empty names from bottom up to first with property name GetDetailsOf(.Items.Item(""), i) 'Property Name GetDetailsOf(.Items.Item(sFile), i) 'Property Value With CreateObject("Shell.Application").Namespace(sFolder)įor i = 0 To 350 'appears to be 322 names in Windows 10 SFile = Right(PathFile, Len(PathFile) - Len(sFolder)) SFolder = Left(PathFile, InStrRev(PathFile, "\")) 'Iterative parts for later to process files in folder pPDFĪįunction oPropertyNames(PathFile As String)ĭim sFolder, sFile '<-Both must be type Variant RNames.Resize(, aProp.Count + 1) = aProp.toarray() Set aProp = oPropertyNames(pPDF & Dir(pPDF & "*.pdf")) 'Must be at least one pdf Set fso = CreateObject("Scripting.FileSystemObject") If Dir(pPDF, vbDirectory) = "" Then Exit Sub 'First cell for property names list to right as column headings That way, 322 columns are not needed but readily found.Īnyway, if you want to give it a run, change the pPDF value and run.ĭim fso As Object, oFolder As Object, oFile As Object When one is picked for the file in A2, then C2 will be updated with that property value. Data Validation list with all property names in B2. This conceptual approach also offers a more dynamic potential. ![]() Howsoever, every once in a while, Microsoft does an upgrade that could impact the code. 99.9% of the time, that would be sufficient. Most people, just hard code the index in. We would get the names, and with IndexOf, we can get just the value from another ArrayList with the values in the same index order. We may just use say 5 property field values. The ArrayList method offers some nice features that we can use later in the file iterative loop. Debug.Print lines were left in as they are good for testing but also show how some things can be shown. If you examine the code, you will see comments with some good tips. Some are blank because it has no property name for that index position. Cell B2 and to the right will have 322 columns filled. Put it into a Module, change pPDF value line in first sub and run it with a blank worksheet active. With the needs of your project in mind, I fleshed most of this out tonight. Normally, when I use GetDetailsOf method, I only need a few properties/metadata. It does not apply to your needs but many concepts could be used in your project. I wish Adobe had not gone the way of leasing software.įor the interim, I did some preparatory work for a GetDetailsOF approach. I will get an old Acrobat version 6 and see if it would work for metadata. Unfortunately, my computer at work no longer has Acrobat. Set oDoc = CreateObject("AcroExch.PDDoc")įor a beginner you seem to grasp more than many. SFile = "e:\aa.pdf" ' I added this to set file path Set objFolderItem = objFolder.ParseName(StrConv(FileName, vbFromUnicode))įileProperty = objFolder.GetDetailsOf(objFolderItem, i)Ĭode Public Sub test(ByVal sFile As String)ĭim strFileName As String, strNumPages As Long, strPageMode As Stringĭim strTitle As String, strSubject As String, strAuthor As Stringĭim strKeywords As String, strCreator As String, strProducer As String Set objFolder = objShell.Namespace(StrConv(FilePath, vbFromUnicode)) Set objShell = CreateObject("Shell.Application") MsgBox FileProperty("C:\Users\ken\Dropbox\", "Getting Started.pdf", "Name"),, "Name"įunction FileProperty(FilePath As String, FileName As String, PropName As String) As String
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |