Computer Hope
Software => Computer programming => Topic started by: cincyshirm61 on June 20, 2013, 01:14:32 PM
-
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.
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!
st1 = PDF.SetInfo("Title", "")
If VBA has a constant literal for nulls use that instead of ""
Citation (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+Tutorials/OLE~TUTORIAL+WINBATCH~OLE~PROGRAMMING~-~Part~1.txt) Do a search for Winbatch Articles
Happy Days 8)
-
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.