ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PDF Information (https://www.excelbanter.com/excel-programming/368824-pdf-information.html)

NSKearns[_2_]

PDF Information
 

Hi All,

I am relavtively new to VBA and I have a problem. I would like to go
through a folder that contains a number of .PDF files and extract the
document name and the the title. Extracting the name of the file is
easy but how can I extract the title. The title can be found by
right-clicking on the file and selecting the PDF tab. I would likt to
produce a list in excel with the file name in one column and the
corresponding 'title' (information) in the adjacent column. Thank you.


--
NSKearns
------------------------------------------------------------------------
NSKearns's Profile: http://www.excelforum.com/member.php...o&userid=36948
View this thread: http://www.excelforum.com/showthread...hreadid=566585


Michel Pierron

PDF Information
 
Hi NSKearns,

Sub EnumPdfFile()
Application.ScreenUpdating = False
Workbooks.Add
Const sPath$ = "Path of the directory to be explored"
Dim PathEntry$, w%
PathEntry = Dir(sPath & "\*.*", vbNormal + vbHidden)
While Len(PathEntry)
If PathEntry < "." And PathEntry < ".." Then
If LCase(Mid(PathEntry, InStr(1, PathEntry, ".") + 1)) = "pdf" Then
w = w + 1
Cells(w, 1) = PathEntry
Cells(w, 2) = PdfTitle(sPath, PathEntry)
End If
PathEntry = Dir()
End If
Wend
Columns("A:B").Columns.AutoFit
End Sub

Private Function PdfTitle$(iPath$, iFile$)
With CreateObject("Shell.Application").NameSpace(CStr(i Path))
PdfTitle = .GetDetailsOf(.ParseName(iFile), 10)
End With
End Function

Regards,
MP


"NSKearns" a écrit
dans le message de news:
...

Hi All,

I am relavtively new to VBA and I have a problem. I would like to go
through a folder that contains a number of .PDF files and extract the
document name and the the title. Extracting the name of the file is
easy but how can I extract the title. The title can be found by
right-clicking on the file and selecting the PDF tab. I would likt to
produce a list in excel with the file name in one column and the
corresponding 'title' (information) in the adjacent column. Thank you.


--
NSKearns
------------------------------------------------------------------------
NSKearns's Profile:
http://www.excelforum.com/member.php...o&userid=36948
View this thread: http://www.excelforum.com/showthread...hreadid=566585




NSKearns[_3_]

PDF Information
 

Thank you for the quick reply. The macro worked magnificently.

Thank you.


--
NSKearns
------------------------------------------------------------------------
NSKearns's Profile: http://www.excelforum.com/member.php...o&userid=36948
View this thread: http://www.excelforum.com/showthread...hreadid=566585



All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com