|
Answer» Hi,
I am looking to write an excel macro that will erase the metadata fields (specifically the "TITLE" field) from pdf documents. I want to paste a list of the full pathnames of multiple PDFS in column a, then run a macro to perform this OPERATION.
Thanks in advance for the help!Maybe this will help. A former coworker wrote a small macro where you would import the full pathnames into column A, run the below macro, and it would add the full FILEPATH to the "Keywords" line in the pdf metadata. This was very helpful when trying to trace extracted pdf pages back to its ORIGINAL file.
Code: [Select]Sub BrandBreakouts() Dim PDF As CAcroPDDoc Dim RawSet As Range Range("A1").Select Range(Selection, Selection.End(xlDown)).Select Set RawSet = Selection Set PDF = CreateObject("AcroExch.PDDoc") For Each pth In RawSet If PDF.Open(pth) = -1 Then st1 = PDF.SetInfo("Keywords", pth) st2 = PDF.Save(PDSaveCollectGarbage, pth) PDF.Close End If Next pth End Sub I just want to clear the title field, rather than add anything. Thanks again!Would have thought finding info about Acrobat objects would have been simple. Guess again!
Code: [Select]st1 = PDF.SetInfo("Title", "")
If VBA has a constant literal for nulls use that instead of ""
Citation Do a search for Winbatch Articles
Happy Days Once again Sidewinder, you're the best! Thank you! Hallo! When I began to step in your Subroutine in my MS VBA 7 in MS Excel 2010 I received error "User-defined type not defined" on declaration "Dim PDF As CAcroPDDoc". Is there missing any library in VBA? In my VBA for Excel, I need to get property "Title" from "PDF information" sheet from PDF file located on my computer. Thanks.
|