Please do not forget to subscribe. Thanks for your support. // WHAT TO WATCH NEXT PDF Automation using VBA: bit.ly/37FZNsS Sharepoint Automation Using VBA: bit.ly/2ZUlwuG Access Database Automation using Excel VBA: bit.ly/2FnOvgV SQL Server Automation Using VBA: bit.ly/2QrJdat Plug and Play Series: bit.ly/39Io6bN Office Quick Tips: bit.ly/36rZX75
Using "AcroExch.HiliteList" I am missing some of the text on my PDF... for some reason certain table headers are not showing up when using this method. Can you help point me in the right direction to capture the text that is inside of a bound rectangle but not showing up under Hilight List.
Interested to become VBA Pro? Here is 100% free guided e-course with Real-life projects. Sign-up to participate, get assignments and a certificate:- bit.ly/3eX8tzl
01:14 - Create a PDF doc 06:29 - Create PDF Form 08:31 - Read PDF content 17:15 - Extract PDF table 22:54 - Read PDF from Fields 43:41 - Manipulate PDF pages
@@VBAA2Z I need one your remote (by AnyDesk or TaemViewer) lesson on this topic (VBA Read/Write PDF). How much will one hour cost? Your help is very necessary.
Awesome video. . Much appreciated for sharing your knowledge. Can you do me a favour please create a video to extract data from multiple pdf in a folder to excel. there should be option to select folder.
was there ever a video posted about the above? using this to automate importing tables from PDF but the PDF file name will be constantly changing. How would I select the "only PDF in the folder" or only PDFs with XXXX in the name? Example Code *(See file Path) ActiveWorkbook.Queries.Add Name:="Table001 (Page 1)", Formula:= _ "let" & Chr(13) & "" & Chr(10) & " Source = Pdf.Tables(File.Contents(""D:\XXXXX\XXXXX\XXXX\XXXXX\XXXXX\XXXXX\PDF Name XXXXXX .pdf""), [Implementation=""1.2""])," & Chr(13) & "" & Chr(10) & " Table001 = Source{[Id=""Table001""]}[Data]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColu" & _ "mnTypes(Table001,{{""Column1"", type text}, {""Column2"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type""" **See File Path. When another PDF is added to this folder, I want VBA to use the new PDF without me having to adjust the code every time. Thank you!
Congratulations on your series. Please add one more example I am interested to know how to fill out forms from excel table to pdf with pdf forms containing various controls like multiple choices, text comments fields, table within form itself extra. Thanks for your video!
@@VBAA2Z Hi, I'm currently struggling on how to edit existing "FreeText" annotations (like how to change text, font, etc). Any help on this topic is greatly appriciated! Maybe you can give a link to an example for VBA or anything like that. Thanks!
Hello, congrats, very clear and powerful. May I ask you if it's possible to open a PDF file and then keep control on it (for example, I would like to open the "Save As" window to invite the user to visualize the file and then save it in a new folder) ? Thanks in advance !
Great video, please explain how to rename PDF files in a folder on the content of PDF files as Invoice number, ID No. etc.. the items (invoice no. etc.. ) are same location in pdf files
This is an AWESOME series my man!!... Excellent work!! How do you add a step(s) in your code to programmatically "Enable All Features" in pdf file? In other words, the file opens in protected view and it needs to be clicked before anything can be done with the file.
@@VBAA2Z I did try this, but because our software is administrator controlled, the settings can't be changed by users. Every adobe file opens in "sandbox" mode, and the "Enable All Features" always has to be manually clicked before being able to export to doc, or worksheet, etc.. I can export the files to "doc" or "spreadsheet" manually after clicking the button. Ideally we would want the code to programmatically do that step and then export as you have written the code to do. When I run the code a run-time error occurs at the jso_obj.SaveAs line... the error states "NotAllowedError: Security settings prevent access to this property or method." Also, can you list the reference libraries required to do/support running the code... maybe on the front end or back end of the video, or simply as part of your narrative under the video.
Tks for sharing! Great Video... just one question... Is it possible to do something like this using just the Adobe Acrobat Reader? Or is mandatory to purchase the Adobe Acrobat Standard / Pro Edition?
This is an AWESOME series my man!!... Excelllent work!! How do you add a step(s) in your code to programmatically "Enable All Features" in pdf files that have that initial security step?
Amazing Buddy. Your resource is amazing. I need make my pdf's to password protected pdf. I am having so many pdf files. Its using my lots of time. It would be really helpful if you could help me with that
What are you trying to see is "different"? If the "FIELDS" in the PDF are exactly the same, but you are trying to determine if the content is different, then you could use the Dictionary structures in VBA to store KEY/VALUE information (create a function that returns Dictionary type, pass in file #1 and store in a Dictionary object, pass in file #2 and store in another Dictionary object). You could then create a "search" function, passing in both sets of Dictionary data and comparing the data "values" EQUAL to each other, based off of matching KEYS.
I have been trying to find out what VBA code is needed to extract all pages from a PDF file and save as separate PDF's. I altready have VBA (Excel) code to remame the exracted PDF's, but if I could extract using VBA, then this would further streamline the workflow. Could not find anything workable on Web?
Hi Bro, thanks for this tutorial. I've a question... When running the first Macro to read PDF, it returned an error "ActiveX cannot create object". Can you help me?
@@VBAA2Z Yes it is! the same version you use, but even so, when I instantiate the object, it returns this error... I'm disappointed because this would help me a lot... 😢
Thank you for sharing detailed tutorial on PDF automation. It is very helpful! I was trying the read form fields in PDF functionality but the excel crashes every time the av_Doc.Open step gets executed. I am not getting any error however the excel is closing and PDF does not open as well. Can you please suggest on this issue. Thanks in advance!
I'm involved in documentation and I'm looking for a way to merge certain files listed in an Excel document. I have made a complex spreadsheet that based of document name and unique ID number i can filter the files needed to merge however trying Power Automate Desktop it can't process the files simply based on their location. I still need to try an IF statement if I can parse the files need to merge based on their unique #ID number e.e. (#3234). So I have a local directory synced with OneDrive that contains 2000+ PDF files and I want to use Excel to drive a VBA to merger files in each row in Excel and loop ForEach line of data to merge hundreds of PDF files. Can this solution help do this?
Is there a way to trigger vba code if text on a pdf was highlighted? For example, if someone highlighted a text from row1 in yellow the vba code would do x. If the text was highlighted in green then vba would perform a different task.
Great video and very helpful. Thanks. Is there a way to have a VBA to attach different type of document such as word,excel, etc. to the pdf instead of print to pdf and combine them?
Hello, if I get this error message: Run time error : "-2147319322 (800280rb)'; "Automation Error, Element no found" And pdf_form_fld 's value is nothing What are the possible causes? Thank you
I have already installed Adobe Acrobat pro. And I have successfully made references to Aformatlib and Adobe pro libraries. How could it still go wrong? I have asked on google to solve the problem but no solution.
Thanks for this tutorial. Very useful. But I am still a little bit confused about the relationship between AcroExch and AcroApp. is AcroExch a function inside AcroApp? Could you further explain to me the relationship between these 2 things?
@@VBAA2Z Thanks for the reply. But I still have no idea about "createObject", is it used for accessing a class inside a class that js not related with VBA? Sorry I am still beginner at VBA. 😄
Basically, AcroApp and AcroExch are the same. Also read below for ===>> Using early binding and late binding in Automation docs.microsoft.com/en-us/previous-versions/office/troubleshoot/office-developer/binding-type-available-to-automation-clients
@@VBAA2Z I mean if this can be done in access. I do generate a report and convert it into a pdf to send out as email. My question is of this can be done the same way but as a PowerPoint
Hello, im getting an error at this point: "For Each pdf_form_field In pdf_form_fields" I´m using Acrobat DC Pro. Can you help me please. Thank you in advance.
Hi there, many have been asking the same question. I've been developing financial models in VBA Programming for over a decade and I'm feeling a bit bored with the white screen so I did some playing around :) I'll definitely share a short video to accomplish this later. Please support us by subscribing to our channel. regards.
Hi, I have published a short 5mins video on how to customize VBA Editor or IDE. Please check it out, hope you like it :) th-cam.com/video/K_sj0GBSLew/w-d-xo.html
Hi Shreekant, First, make sure Acrobat is referenced. th-cam.com/video/uc6palG76Y8/w-d-xo.html If you're facing this error, it looks like your office needs to be repaired. support.microsoft.com/en-gb/help/828550/you-receive-run-time-error-429-when-you-automate-office-applications All the best. Let me know if you still face problem
I'm getting a security issue when doing 'jso_obj.SaveAs dfile, "com.adobe.acrobat." & ext' From what I can fine online it is because Acrobat java security is preventing it. I"m reading about how you have to create a trusted function but I'm not sure the best way to go about it. Doesnt look like you ran into this issue though, any advice?
Hello, I have a question on combining PDF files. I would like to combine cover sheets with a specific name to their corresponding files with same filename. I have and excel document in which I use to generate the cover sheets- they are exported as PDFs with specific filenames from the excel sheet. Is there some way to define the two folder locations and have it reference the filenames from the excel file for combining the PDF? For example: Cover1, Cover2, Cover3 need to be added to Fax1, Fax2, Fax3... without having to do the todoc/fromdoc for each of the three sets, can we just change the filenames dynamically? Then the output would be Combined1, Combined2, Combined3?
Yes you can set the mapping / settings and let your code take care of the rest. for example file name | page index | dst page order index | etc. refer to this section in video. th-cam.com/video/uc6palG76Y8/w-d-xo.html
@@VBAA2Z I am not sure how to setup the filename. I tried to combine my mail merge code to get the filenames selection but the combined output only has the cover sheet and did not append the other file. Additionally to get it to work, I had to paste in the file paths within quotes to get it to run. (e.g. ***If toDoc.Save(PDSaveFull, "H:\Combo Pack\combo_Fax1.pdf") ***) Can you please help me? This is the code I tried to write: Const Route_Slip As String = "H:\Playground\" Const Fax As String = "H:\Faxes\" Const SOURCE_FILE_PATH As String = "H:Fax Mail Merge File.xlsx" Const ComboFax As String = "H:\Combo\" Option Explicit Function combine_pdf() Dim Aapp As Acrobat.AcroApp Dim toDoc As Acrobat.AcroPDDoc Dim fromDoc As Acrobat.AcroPDDoc Dim dbPath As String Dim recordNumber As Long, totalRecord As Long Set Aapp = CreateObject("AcroExch.App") Set toDoc = CreateObject("AcroExch.PDDoc") Set fromDoc = CreateObject("AcroExch.PDDoc") Aapp.Show Set fromDoc = ActiveDocument With fromDoc.MailMerge .OpenDataSource Name:=SOURCE_FILE_PATH, sqlstatement:="SELECT * FROM ['Incoming Fax$'])" totalRecord = .DataSource.RecordCount For recordNumber = 1 To totalRecord
With .DataSource .ActiveRecord = recordNumber .FirstRecord = recordNumber .LastRecord = recordNumber End With .Destination = wdSendToNewDocument .Execute False
Set toDoc = ActiveDocument fromDoc.Open (Route_Slip & .DataSource.DataFields("Fax_ID").Value & ".pdf") toDoc.Open (Fax & .DataSource.DataFields("Fax_ID").Value & ".pdf") If toDoc.InsertPages(0, fromDoc, 0, fromDoc.GetNumPages(), True) = False Then Debug.Print "failed into insert page" End If If toDoc.Save(PDSaveFull, ComboFax & .DataSource.DataFields("Fax_ID").Value & ".pdf") = False Then Debug.Print "failed to save" Else Debug.Print "doc saved" End If toDoc.Close False
Set toDoc = Nothing
Next recordNumber End With Set fromDoc = Nothing toDoc.Close fromDoc.Close Aapp.Exit Set Aapp = Nothing Set toDoc = Nothing Set fromDoc = Nothing Set Aapp = Nothing End Function
Hi Lung, Adobe also provides Acrobat DC SDK (Software Development Kit) where they do provide an acrobat library in the headers folder. Can you tell me how to use SDK for only development purposes?
Hello friend, you can use pdfPage.GetNumAnnots method for this. If you need this urgently, you just need to implement GetNumAnnots method in this part of the video. Else I'll add them later the playlist of VBA PDF Automation. th-cam.com/video/uc6palG76Y8/w-d-xo.html regards. Please do not forget to subscribe :)
above was to read: to add take a look at Acrobat JS API Reference from SDK pdf of the video description. js = "var annot = this.addAnnot({" &vblf _ & "page: 0," &vblf _ & "type: ""Text"", " &vblf _ & "author: ""author_name"", " &vblf _ & "point: [100,500], " &vblf _ & "contents: ""this is your note."", " &vblf _ & "noteIcon: ""Help"" " &vblf _ & "});" '//execute the js code pdPage.Fields.ExecuteThisJavaScript js hope this helps.
Having an issue - with setting the application (application) as Acrobat. acrobat is not in the list. I have and use it daily. Can see the path and that its is running on my operating system. the error I receive is compile error User-defined type not defined" is there another way to specify the application. And how to a loop this to combine 6 files, just adding each to the end/after last page/ of the prior. This will save a ton of time if I can get it to work. Thank you for the detail on how to complete this.
Needed to open the correct reference library under tools. Now acrobat opens but the files dont open and combine. code is running and doesnt not show error but appears to just spin with acrobat open.
I am getting error while step through the same code in video, in the first createobject statement. I have checked adobe acrobat 10.0 library. I am getting error like Run-time error '-2147467262(80004002)': "No such interface supported". Adobe Acrobat reader DC installed in my machine. Please help out to over come this issue.
can you please help me to put approved stamp for scan PDF file which is opened already. by using VBA code(need stamp for all open PDF file and close automatically
Hello there, this is a super awesome and informative video! Is there also a way to "click" on a button in a pdf form (I have a pdf form from the government where I want to automate input from Excel line by line. After each line I need to click the button in order to make it possible to input the next line) Thank you very much in advance! :)
@@VBAA2Z Hi! Thank you for your great materials! I tried to find it in the API but the only security option that I found is "ISecuritySettings" but that runs for the "Method or data member not found" error. Could you please help to add password protection to existing PDF files with Adobe Acrobat with VBA?
Is your goal to make the document READ ONLY to an end user? If so, use .IsReadOnly = True, If you are trying to prevent changes at the Acrobat level, using a password, I have not attempted that action yet.
I haven't tried it myself but I'm sure there is API which we can use to encrypt the file / open with password (Owner / Open). try google and let me know how it goes.
Most projects and source code are free for downloads. You can now support the channel buying any of the Project or Source Code vbaa2z.blogspot.com/2020/12/you-can-support-vba-a2z-by-simply.html
@@VBAA2Z Thanks for the quick reply. I have been searching for a long time for a process that will extract information from a PDF so that I can process it in a MS Access app and save the data into a database. The PDF document that I am extracting from has a few tables but the cells in the tables are not filled in consistently, some cells are blank some are not. The solutions that I have found so far do NOT handle this well (eg. they DO NOT show me the cells in the table that are not filled in so that I can maintain the proper format of the table. I was hoping to try your approach (code) to see how it worked and was hoping to NOT have to retype the code as I watched the youtube video. Thanks,
No probs, I'm happy to share the code but I didn't record this in single shot and not sure if I saved them. Please email (in video description) me which code you need.
Hi can you please help me out with vba solution for my project. I have 2 pdf files File-A.pdf - 10 pages - each page having details in a perticular format table. File-B.pdf -10 pages - Blank just having unique value on each page bottom. How can I merge these 2 file to 1 single pdf So that FileB.pdf file bottom value could be printed on each page of FileA.pdf Like FileA.pdf page1 should be printed with FileB.pdf page 1 and so on upto 10th page. Thanks in advance.
Holy cow would this be useful if I could get it to work. Thanks for this video! Is anyone else having trouble with .Save being recognized? Method or data member is not found. From what I could see in the documentation of Acrobat API and VBA help, .Save is only to be used as a Workbook object command. It doesn't like the AcroAVDoc. I suspect I don't have a tool enabled or my employer is blocking some function on then network. Any ideas?
Hi Luci, thanks for your visit. .Save is valid method, and shouldn't be disabled after paying for it. Make sure you have the valid Adobe Acrobat DC or Adobe Acrobat Pro.
I Entered all of the code exactly as you did and I am getting an error code. Run-Time error '1004': Application-defined or object-defined error. After digging into it a while, I found that when the code is getting the text, if it runs into an equal sign "=" this is when it fails. My form has several "=" equal signs so during the investigation I took out the first instance of the ='s and ran the code again and it failed at the second instance of an = sign. so I know it is the ='s how can I bypass the equal sign, without removing them all from the document first? Thanks
You'll find various ways to read pdf in the series. Have you explored query method? converting to word and reading from there perhaps... th-cam.com/video/uc6palG76Y8/w-d-xo.html
i have 100 excel workbooks in a folder i want to browse and select 95 excel sheet and copy sheet 2 data of each Excel workbooks ,I want all 95excel workbook data to a new workbook sheet1 , paste one below one using vba code ,
Hi Anmol, thanks for reaching out. Please confirm, are you looking to 1. Option to select 95 Excel Workbooks/Files 2. Based on selection import data from 2 sheet of each file 3. Paste them to a new master workbook in new Excel Workbook/File?
1.i want to browse than select any folder . 2. then select excel workbooks ,persent in the folder. Based on selection import data from 2 sheet of each file 3.Paste them to a new master workbook in new Excel Workbook/File? in sheet1 paste data one after one.
Hi Anmol, hope this tutorial will solve your requirements. We've just published a new video, Enjoy and please do continue to support us. th-cam.com/video/eHuETf6ygto/w-d-xo.html
Hi! Thank you so much for the video! I am getting Compile error: Method or data member not found, and GetNumPages is highlighted during the line For i = 0 To pdf_doc.GetNumPages - 1. Can you help? I was trying to read from a PDF file. Thank you!
I got the code to work by making some adjustments. Is there a limit how complex the PDF file is? I can open one simple file but I can't open another more complex file. The I have an Adobe Acrobat error: "There was an error opening this document. The file cannot be found" - I know the path is right and the file is where it is supposed to be.
Hi, I have been doing pdf automation through VBA and did not find the solution or way to upload images to the pdf form programmatically. would you please guide me?
Please do not forget to subscribe. Thanks for your support.
// WHAT TO WATCH NEXT
PDF Automation using VBA: bit.ly/37FZNsS
Sharepoint Automation Using VBA: bit.ly/2ZUlwuG
Access Database Automation using Excel VBA: bit.ly/2FnOvgV
SQL Server Automation Using VBA: bit.ly/2QrJdat
Plug and Play Series: bit.ly/39Io6bN
Office Quick Tips: bit.ly/36rZX75
Using "AcroExch.HiliteList" I am missing some of the text on my PDF... for some reason certain table headers are not showing up when using this method. Can you help point me in the right direction to capture the text that is inside of a bound rectangle but not showing up under Hilight List.
Interested to become VBA Pro? Here is 100% free guided e-course with Real-life projects. Sign-up to participate, get assignments and a certificate:- bit.ly/3eX8tzl
New Video --- > VBA to Read or Extract PDF Tables without Reader or Acrobat API - VBA PDF Automation-11
th-cam.com/video/KoTuy92uboY/w-d-xo.html
01:14 - Create a PDF doc
06:29 - Create PDF Form
08:31 - Read PDF content
17:15 - Extract PDF table
22:54 - Read PDF from Fields
43:41 - Manipulate PDF pages
thanks
@@VBAA2Z I need one your remote (by AnyDesk or TaemViewer) lesson on this topic (VBA Read/Write PDF). How much will one hour cost? Your help is very necessary.
Thanks a lot!!
Learned many things from your channel. Nice work.... keep going. Thanks!
Great to hear!
Man you are legend, simply genius.
Thanks!
You’re doing good job sharing your knowledge. Keep it up!
You're simply brilliant ... D Man ...Superb Brother...God bless you !!!
Thank you so much 😀 God bless you too
I need this badly, sending order your way. Thank you my friend!
Hope you enjoy it!
Awesome video. . Much appreciated for sharing your knowledge.
Can you do me a favour please create a video to extract data from multiple pdf in a folder to excel. there should be option to select folder.
was there ever a video posted about the above? using this to automate importing tables from PDF but the PDF file name will be constantly changing. How would I select the "only PDF in the folder" or only PDFs with XXXX in the name? Example Code *(See file Path)
ActiveWorkbook.Queries.Add Name:="Table001 (Page 1)", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Pdf.Tables(File.Contents(""D:\XXXXX\XXXXX\XXXX\XXXXX\XXXXX\XXXXX\PDF Name XXXXXX .pdf""), [Implementation=""1.2""])," & Chr(13) & "" & Chr(10) & " Table001 = Source{[Id=""Table001""]}[Data]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColu" & _
"mnTypes(Table001,{{""Column1"", type text}, {""Column2"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type"""
**See File Path. When another PDF is added to this folder, I want VBA to use the new PDF without me having to adjust the code every time.
Thank you!
Congratulations on your series. Please add one more example I am interested to know how to fill out forms from excel table to pdf with pdf forms containing various controls like multiple choices, text comments fields, table within form itself extra. Thanks for your video!
Sure Sam, please subscribe and support our channel. Thanks
Thank you sir I'm your fan. Please keep sharing awesome videos
this is amazing work sir. thank you!!!
Most welcome!
you're the man! keep it up brother.
31:04 Write PDF
Thanks dude
Most welcome!!!
Thank you sir for sharing your knowledge with us.
wow-amazing and super helpful pdf automation video. thanks
You are welcome
Great.🤩
Thank you! Cheers!
Wow!! Amazing. Thank sto you sir.
You are very welcome
Very useful from my end thanks!!
You're welcome!
great videos, it helping me alot.Thank you so much
Glad to hear that!
Very informative tutorials. Thanks Lung.
Great series👍
Thanks
Thank you so much for useful videos
So nice of you
thank you so much sirji
So nice of you
thank you so much sir
Most welcome
Congrats on your new series!
Really interesting and totally worth it.
Appreciate your support as always!
Please subscribe for upcoming videos and share with your friends too.
If you get some time please show us how to implement filling up the pdf forms using the table from excel sheet itself. Thanks
Sure Holie, If you're new to VBA Programming I'd make some more videos to compliment the series.
Thanks
Keep it up. awesome series, loved the data extracts part.
Very useful! Thanks a lot!
Glad it was helpful!
@@VBAA2Z Hi, I'm currently struggling on how to edit existing "FreeText" annotations (like how to change text, font, etc). Any help on this topic is greatly appriciated! Maybe you can give a link to an example for VBA or anything like that. Thanks!
@@fromnsk try and look up
jso.AddAnnot
Very good!!!
Thanks!!
Hello, congrats, very clear and powerful.
May I ask you if it's possible to open a PDF file and then keep control on it (for example, I would like to open the "Save As" window to invite the user to visualize the file and then save it in a new folder) ?
Thanks in advance !
great
Great video, please explain how to rename PDF files in a folder on the content of PDF files as Invoice number, ID No. etc.. the items (invoice no. etc.. ) are same location in pdf files
You can use Name statement to do that.
Name oldpathname As newpathname
Wow! Great! Do you also able to manipulate radio buttons through VBA? F.e. to choose male or female (both are concerned to group sex) ?
thanks for watching. yes you can there should be demo in this video
This is an AWESOME series my man!!... Excellent work!!
How do you add a step(s) in your code to programmatically "Enable All Features" in pdf file? In other words, the file opens in protected view and it needs to be clicked before anything can be done with the file.
Thanks Javier. I'll have to check that and come back to you.
have you tried this settings instead ?
helpx.adobe.com/reader/using/protected-mode-windows.html
@@VBAA2Z I did try this, but because our software is administrator controlled, the settings can't be changed by users. Every adobe file opens in "sandbox" mode, and the "Enable All Features" always has to be manually clicked before being able to export to doc, or worksheet, etc.. I can export the files to "doc" or "spreadsheet" manually after clicking the button. Ideally we would want the code to programmatically do that step and then export as you have written the code to do.
When I run the code a run-time error occurs at the jso_obj.SaveAs line... the error states "NotAllowedError: Security settings prevent access to this property or method."
Also, can you list the reference libraries required to do/support running the code... maybe on the front end or back end of the video, or simply as part of your narrative under the video.
Great Video, Thanks for sharing. I have a question, how we can highlight a text/number in a pdf document from the excel sheet? Thanks for your help!
you can use annotation
Thanks a lot!
You're welcome!
Tks for sharing! Great Video... just one question... Is it possible to do something like this using just the Adobe Acrobat Reader? Or is mandatory to purchase the Adobe Acrobat Standard / Pro Edition?
Thanks for watching. It is not possible with reader...you'll need Acrobat pro or other APIs
This is an AWESOME series my man!!... Excelllent work!!
How do you add a step(s) in your code to programmatically "Enable All Features" in pdf files that have that initial security step?
Thanks Sandra. I'll have to check that and come back to you.
have you tried this settings instead ?
helpx.adobe.com/reader/using/protected-mode-windows.html
Amazing Buddy. Your resource is amazing.
I need make my pdf's to password protected pdf. I am having so many pdf files. Its using my lots of time.
It would be really helpful if you could help me with that
Will upload soon, thanks for your suggestion
@@VBAA2Z Appreciate your quick response. It shows how dedicated you are towards your work.
Waiting for the video.
Thank you!!🙂
Hi,
Could you please create a video on how to compare 2 PDF files for differnce?
Sure I'll try and make more videos in near future.
below link will get you started
th-cam.com/video/ZWizyQ8_9s0/w-d-xo.html
What are you trying to see is "different"? If the "FIELDS" in the PDF are exactly the same, but you are trying to determine if the content is different, then you could use the Dictionary structures in VBA to store KEY/VALUE information (create a function that returns Dictionary type, pass in file #1 and store in a Dictionary object, pass in file #2 and store in another Dictionary object). You could then create a "search" function, passing in both sets of Dictionary data and comparing the data "values" EQUAL to each other, based off of matching KEYS.
Thanxx
Welcome
I have been trying to find out what VBA code is needed to extract all pages from a PDF file and save as separate PDF's. I altready have VBA (Excel) code to remame the exracted PDF's, but if I could extract using VBA, then this would further streamline the workflow. Could not find anything workable on Web?
You can easily complete this with Acrobat API however if you're looking for another solution custom lib solution will be to be developed
Hi Bro, thanks for this tutorial.
I've a question...
When running the first Macro to read PDF, it returned an error "ActiveX cannot create object". Can you help me?
Looks like Acrobat not installed :)
@@VBAA2Z Yes it is! the same version you use, but even so, when I instantiate the object, it returns this error... I'm disappointed because this would help me a lot... 😢
Thank you for sharing detailed tutorial on PDF automation. It is very helpful!
I was trying the read form fields in PDF functionality but the excel crashes every time the av_Doc.Open step gets executed. I am not getting any error however the excel is closing and PDF does not open as well.
Can you please suggest on this issue.
Thanks in advance!
Which version of Adobe Acrobat do you have?
Hi need to extract specific data from PDF to Excel Ex: invoice no , Order No , Customer PO , Part Number , Description , Qty & Value ...
This video should help
This is a great deal of PDF automation knowledge. Can you please also share how to set PDF open passwords using VBA? Thank you.
I have not tried myself but I'm sure there is API which we can use to encrypt the file with password (Owner / Open).
@@VBAA2Z please try.
Any way to combine multiple pdf without acrobat? Thanks for this detailed and useful series.
Will share something soon!
I'm involved in documentation and I'm looking for a way to merge certain files listed in an Excel document. I have made a complex spreadsheet that based of document name and unique ID number i can filter the files needed to merge however trying Power Automate Desktop it can't process the files simply based on their location. I still need to try an IF statement if I can parse the files need to merge based on their unique #ID number e.e. (#3234). So I have a local directory synced with OneDrive that contains 2000+ PDF files and I want to use Excel to drive a VBA to merger files in each row in Excel and loop ForEach line of data to merge hundreds of PDF files. Can this solution help do this?
Great video, really helped me out! I am using the read pdf form VBA. Is there an easy way to put the values into columns instead of rows?
Transpose?
Is there a way to trigger vba code if text on a pdf was highlighted? For example, if someone highlighted a text from row1 in yellow the vba code would do x. If the text was highlighted in green then vba would perform a different task.
VBA Events will work within office app only, so if you select a text in PDF it won't get triggered.
good approach.. I need to know who to extract particular table value from PDF to excel sheet without acrobat.?
Great video and very helpful. Thanks. Is there a way to have a VBA to attach different type of document such as word,excel, etc. to the pdf instead of print to pdf and combine them?
Did you try to create a PDF from the word (1:14) and then manipulate pages within the documents (43:41)?
Hello, if I get this error message:
Run time error : "-2147319322 (800280rb)';
"Automation Error, Element no found"
And pdf_form_fld 's value is nothing
What are the possible causes?
Thank you
Have you installed Acrobat Pro or DC?
@@VBAA2Z yes I ve installed acrobat pro .
I have already installed Adobe Acrobat pro. And I have successfully made references to Aformatlib and Adobe pro libraries. How could it still go wrong? I have asked on google to solve the problem but no solution.
Doing Good Job ! Can you please share , how to protect the PDF File (already Existed once) with password by vba
Sure. I'll share asap.
@@VBAA2Z can you please share with me too
Bro.. please use little bigger font ... Not able to read small fonts.. and change background color or font color... Make them easy to read ..
Thanks for your suggestions.
If I use the 7-day trial will the code still work after the trial (supposing that I won't buy it)?
You'll probably get unable to create object error when the license is expired.
Thanks for this tutorial. Very useful. But I am still a little bit confused about the relationship between AcroExch and AcroApp. is AcroExch a function inside AcroApp? Could you further explain to me the relationship between these 2 things?
Below should clarify.
Dim myApp As Acrobat.AcroApp
Set myApp = CreateObject("AcroExch.App")
@@VBAA2Z Thanks for the reply. But I still have no idea about "createObject", is it used for accessing a class inside a class that js not related with VBA? Sorry I am still beginner at VBA. 😄
Basically, AcroApp and AcroExch are the same. Also read below for
===>> Using early binding and late binding in Automation
docs.microsoft.com/en-us/previous-versions/office/troubleshoot/office-developer/binding-type-available-to-automation-clients
@@VBAA2Z Thanks so much !
no probs!
Great job,
I was wondering if this can be done in ACCESS. I can make pdf reports from Access report or a form but can do the same with PowerPoint.
Yes, absolutely
@@VBAA2Z I mean if this can be done in access. I do generate a report and convert it into a pdf to send out as email. My question is of this can be done the same way but as a PowerPoint
Hello, im getting an error at this point: "For Each pdf_form_field In pdf_form_fields"
I´m using Acrobat DC Pro.
Can you help me please.
Thank you in advance.
Same error here =(
I think its cause by a recent update
Is there a way to do this without Adobe? the team using the software will not all have that installed, just office/excel.
For non API related please check
th-cam.com/video/KoTuy92uboY/w-d-xo.html
th-cam.com/video/KoTuy92uboY/w-d-xo.html
Hello, excellent video, I need to extract the text from a PDF excluding the comments, is this possible?
Kind regards
Yes, it can be done using Acrobat API.
You can also check out episodes 11 and 12.
th-cam.com/video/KoTuy92uboY/w-d-xo.html
Hi, I am not able to find the library which is shown in video. I mean how do I get that library reference in VBA?
More resources here vbaa2z.blogspot.com/2020/01/vba-pdf-automation-read-write-extract.html
You can download a free trial of Acrobat Pro to start with
May i know how did you made the background black?
Hi there, many have been asking the same question. I've been developing financial models in VBA Programming for over a decade and I'm feeling a bit bored with the white screen so I did some playing around :)
I'll definitely share a short video to accomplish this later.
Please support us by subscribing to our channel.
regards.
Hi, I have published a short 5mins video on how to customize VBA Editor or IDE. Please check it out, hope you like it :)
th-cam.com/video/K_sj0GBSLew/w-d-xo.html
Hi
I'm getting "ActiveX component can't create object error " while combining the two PDFs into single. Please anyone suggest me.
Hi Shreekant,
First, make sure Acrobat is referenced.
th-cam.com/video/uc6palG76Y8/w-d-xo.html
If you're facing this error, it looks like your office needs to be repaired.
support.microsoft.com/en-gb/help/828550/you-receive-run-time-error-429-when-you-automate-office-applications
All the best. Let me know if you still face problem
I'm getting a security issue when doing 'jso_obj.SaveAs dfile, "com.adobe.acrobat." & ext' From what I can fine online it is because Acrobat java security is preventing it. I"m reading about how you have to create a trusted function but I'm not sure the best way to go about it. Doesnt look like you ran into this issue though, any advice?
Figured this one out, it's because I do not have the Pro version of acrobat installed.
Hey Nick, nice work there doing additional research yourself and sharing with community here.
Cheers!
Can I edit an existing pdf file after comparing a field in this pdf with a value in my excel sheet without Abode Acrobat
not without Acrobat.
@@VBAA2ZThank you for the quick reply .Is it possible to enter a text at the end of each page in the pdf?
Hello, I have a question on combining PDF files. I would like to combine cover sheets with a specific name to their corresponding files with same filename. I have and excel document in which I use to generate the cover sheets- they are exported as PDFs with specific filenames from the excel sheet. Is there some way to define the two folder locations and have it reference the filenames from the excel file for combining the PDF? For example: Cover1, Cover2, Cover3 need to be added to Fax1, Fax2, Fax3... without having to do the todoc/fromdoc for each of the three sets, can we just change the filenames dynamically? Then the output would be Combined1, Combined2, Combined3?
Yes you can set the mapping / settings and let your code take care of the rest.
for example
file name | page index | dst page order index | etc.
refer to this section in video. th-cam.com/video/uc6palG76Y8/w-d-xo.html
@@VBAA2Z I am not sure how to setup the filename.
I tried to combine my mail merge code to get the filenames selection but the combined output only has the cover sheet and did not append the other file. Additionally to get it to work, I had to paste in the file paths within quotes to get it to run. (e.g. ***If toDoc.Save(PDSaveFull, "H:\Combo Pack\combo_Fax1.pdf") ***)
Can you please help me?
This is the code I tried to write:
Const Route_Slip As String = "H:\Playground\"
Const Fax As String = "H:\Faxes\"
Const SOURCE_FILE_PATH As String = "H:Fax Mail Merge File.xlsx"
Const ComboFax As String = "H:\Combo\"
Option Explicit
Function combine_pdf()
Dim Aapp As Acrobat.AcroApp
Dim toDoc As Acrobat.AcroPDDoc
Dim fromDoc As Acrobat.AcroPDDoc
Dim dbPath As String
Dim recordNumber As Long, totalRecord As Long
Set Aapp = CreateObject("AcroExch.App")
Set toDoc = CreateObject("AcroExch.PDDoc")
Set fromDoc = CreateObject("AcroExch.PDDoc")
Aapp.Show
Set fromDoc = ActiveDocument
With fromDoc.MailMerge
.OpenDataSource Name:=SOURCE_FILE_PATH, sqlstatement:="SELECT * FROM ['Incoming Fax$'])"
totalRecord = .DataSource.RecordCount
For recordNumber = 1 To totalRecord
With .DataSource
.ActiveRecord = recordNumber
.FirstRecord = recordNumber
.LastRecord = recordNumber
End With
.Destination = wdSendToNewDocument
.Execute False
Set toDoc = ActiveDocument
fromDoc.Open (Route_Slip & .DataSource.DataFields("Fax_ID").Value & ".pdf")
toDoc.Open (Fax & .DataSource.DataFields("Fax_ID").Value & ".pdf")
If toDoc.InsertPages(0, fromDoc, 0, fromDoc.GetNumPages(), True) = False Then
Debug.Print "failed into insert page"
End If
If toDoc.Save(PDSaveFull, ComboFax & .DataSource.DataFields("Fax_ID").Value & ".pdf") = False Then
Debug.Print "failed to save"
Else
Debug.Print "doc saved"
End If
toDoc.Close False
Set toDoc = Nothing
Next recordNumber
End With
Set fromDoc = Nothing
toDoc.Close
fromDoc.Close
Aapp.Exit
Set Aapp = Nothing
Set toDoc = Nothing
Set fromDoc = Nothing
Set Aapp = Nothing
End Function
Wonderful! Please could you help me. I need to check a term in a pdf doc and replace it. How does it work? (find and replace). Thank you
If you have Acrobat Pro you can perform this using API.
Yes very useful vedio and i am getting error like this "runtime error " ActiveX component can't create object
thanks for watching.
Do you have the Acrobat Library referenced?
@@VBAA2Z no how to fix it
You'll need Acrobat API for this to work. Do you have one?
vbaa2z.blogspot.com/2020/01/vba-pdf-automation-read-write-extract.html
Hi Lung, Adobe also provides Acrobat DC SDK (Software Development Kit) where they do provide an acrobat library in the headers folder. Can you tell me how to use SDK for only development purposes?
Hi Kamal, please check these useful FAQs
www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF_library_XV_SDK_FAQ_ue.pdf
How to add text box or replace/edit a word. It will more helpful. Thank u
Great suggestion!
Good work buddy, can I select a pdf file using open file dailog box
thanks.
Yes, of course. Check below
th-cam.com/video/eHuETf6ygto/w-d-xo.html
@@VBAA2Z it is for excel only unable to select pdf files
@@PrudhveeSagar change below line
.Filters.Add "All Files", "*.xls*"
to
.Filters.Add "All Files", "*.pdf*"
Thank you bro
Is there a way to generate custom word letter files from excel data
I've 4000 pdf files in a folder and I want to print only 2nd page of each pdf file.
this might help vbaa2z.blogspot.com/2021/04/useful-ready-to-use-vba-functions-share.html
Anyway to create and save notes in pdf files using VBA?
Hello friend, you can use pdfPage.GetNumAnnots method for this.
If you need this urgently, you just need to implement GetNumAnnots method in this part of the video. Else I'll add them later the playlist of VBA PDF Automation.
th-cam.com/video/uc6palG76Y8/w-d-xo.html
regards.
Please do not forget to subscribe :)
above was to read:
to add take a look at Acrobat JS API Reference from SDK pdf of the video description.
js = "var annot = this.addAnnot({" &vblf _
& "page: 0," &vblf _
& "type: ""Text"", " &vblf _
& "author: ""author_name"", " &vblf _
& "point: [100,500], " &vblf _
& "contents: ""this is your note."", " &vblf _
& "noteIcon: ""Help"" " &vblf _
& "});"
'//execute the js code
pdPage.Fields.ExecuteThisJavaScript js
hope this helps.
Having an issue - with setting the application (application) as Acrobat. acrobat is not in the list.
I have and use it daily. Can see the path and that its is running on my operating system. the error I receive is compile error User-defined type not defined" is there another way to specify the application.
And
how to a loop this to combine 6 files, just adding each to the end/after last page/ of the prior.
This will save a ton of time if I can get it to work.
Thank you for the detail on how to complete this.
Needed to open the correct reference library under tools.
Now acrobat opens but the files dont open and combine. code is running and doesnt not show error but appears to just spin with acrobat open.
Where to find the code apart from video ?
I am getting error while step through the same code in video, in the first createobject statement. I have checked adobe acrobat 10.0 library. I am getting error like Run-time error '-2147467262(80004002)': "No such interface supported". Adobe Acrobat reader DC installed in my machine. Please help out to over come this issue.
can you please help me to put approved stamp for scan PDF file which is opened already. by using VBA code(need stamp for all open PDF file and close automatically
perhaps add and position 'Approved' png image to pdf
Please help.... PDDoc = New Acrobat.AcroPDDoc throws an error - Runtime error '429' ActiveX component can't create object
Hi I am getting error on createobject(“AcroExch.app”)
Active x components cannot create objects plz reply anyone
Hi - please make sure you have the Acrobat library referenced
Hello there, this is a super awesome and informative video! Is there also a way to "click" on a button in a pdf form (I have a pdf form from the government where I want to automate input from Excel line by line. After each line I need to click the button in order to make it possible to input the next line) Thank you very much in advance! :)
try exploring Sendkey method
Hi! Have you tried password-protecting an existing PDF file in Adobe Acrobat with Excel VBA?
I haven't but I'm sure there is API which we can use to encrypt the file with password (Owner / Open).
@@VBAA2Z Hi! Thank you for your great materials!
I tried to find it in the API but the only security option that I found is "ISecuritySettings" but that runs for the "Method or data member not found" error.
Could you please help to add password protection to existing PDF files with Adobe Acrobat with VBA?
Is your goal to make the document READ ONLY to an end user? If so, use .IsReadOnly = True,
If you are trying to prevent changes at the Acrobat level, using a password, I have not attempted that action yet.
Thanks for the video. I did not find Adobe Acrobat 10.0 library in references. Can you please help me on hoe to get it?
Check this page. vbaa2z.blogspot.com/2020/01/vba-pdf-automation-read-write-extract.html
Does it work if I only have that version? If I have adove acrobat reader DC, does it work?
@@andresgiovannyhernandezbon7964 I have downloaded Adobe Acrobat DC only.Not working. I am gonna try with Adobe Acrobat X today
Thanks for your video I am having one doubt in pdf how to open protected pdf file through vba is there any way to open the PDF
I haven't tried it myself but I'm sure there is API which we can use to encrypt the file / open with password (Owner / Open). try google and let me know how it goes.
great tutorial. thank a lot.
Are source code available for purchase?
Most projects and source code are free for downloads.
You can now support the channel buying any of the Project or Source Code vbaa2z.blogspot.com/2020/12/you-can-support-vba-a2z-by-simply.html
@@VBAA2Z Thanks for quick response. Happy to support.
Hello, do we need acrobat pro paid version to interact with pdf.
yes
@@VBAA2Z Thanks 😊
Hi, GREAT VIDEOS!!! Do you have a web site or some place where we can get the code for your examples?
Thanks Richard. Sorry , code download are not available for these projects but please let me know if you're stuck i'm happy to look into it.
@@VBAA2Z Thanks for the quick reply. I have been searching for a long time for a process that will extract information from a PDF so that I can process it in a MS Access app and save the data into a database. The PDF document that I am extracting from has a few tables but the cells in the tables are not filled in consistently, some cells are blank some are not. The solutions that I have found so far do NOT handle this well (eg. they DO NOT show me the cells in the table that are not filled in so that I can maintain the proper format of the table. I was hoping to try your approach (code) to see how it worked and was hoping to NOT have to retype the code as I watched the youtube video.
Thanks,
No probs, I'm happy to share the code but I didn't record this in single shot and not sure if I saved them. Please email (in video description) me which code you need.
Hi can you please help me out with vba solution for my project.
I have 2 pdf files
File-A.pdf - 10 pages - each page having details in a perticular format table.
File-B.pdf -10 pages - Blank just having unique value on each page bottom.
How can I merge these 2 file to 1 single pdf
So that FileB.pdf file bottom value could be printed on each page of FileA.pdf
Like FileA.pdf page1 should be printed with FileB.pdf page 1 and so on upto 10th page.
Thanks in advance.
Holy cow would this be useful if I could get it to work. Thanks for this video!
Is anyone else having trouble with .Save being recognized? Method or data member is not found. From what I could see in the documentation of Acrobat API and VBA help, .Save is only to be used as a Workbook object command. It doesn't like the AcroAVDoc. I suspect I don't have a tool enabled or my employer is blocking some function on then network. Any ideas?
Hi Luci, thanks for your visit.
.Save is valid method, and shouldn't be disabled after paying for it.
Make sure you have the valid Adobe Acrobat DC or Adobe Acrobat Pro.
I Entered all of the code exactly as you did and I am getting an error code. Run-Time error '1004': Application-defined or object-defined error. After digging into it a while, I found that when the code is getting the text, if it runs into an equal sign "=" this is when it fails. My form has several "=" equal signs so during the investigation I took out the first instance of the ='s and ran the code again and it failed at the second instance of an = sign. so I know it is the ='s how can I bypass the equal sign, without removing them all from the document first? Thanks
Did you set reference to Acrobat Library?
For combine pdf. Does it work if I only have that version? If I have adove acrobat reader DC, does it work?
Yes you'll need Acrobat, reader won't work.
how to make it one line of text from pdf to excel? because yr video show extract one word one excel row
You'll find various ways to read pdf in the series. Have you explored query method? converting to word and reading from there perhaps...
th-cam.com/video/uc6palG76Y8/w-d-xo.html
i have 100 excel workbooks in a folder i want to browse and select 95 excel sheet and copy sheet 2 data of each Excel workbooks ,I want all 95excel workbook data to a new workbook sheet1 , paste one below one using vba code ,
Hi Anmol, thanks for reaching out. Please confirm, are you looking to
1. Option to select 95 Excel Workbooks/Files
2. Based on selection import data from 2 sheet of each file
3. Paste them to a new master workbook in new Excel Workbook/File?
1.i want to browse than select any folder .
2. then select excel workbooks ,persent in the folder. Based on selection import data from 2 sheet of each file
3.Paste them to a new master workbook in new Excel Workbook/File? in sheet1 paste data one after one.
Hi Anmol, hope this tutorial will solve your requirements.
We've just published a new video, Enjoy and please do continue to support us.
th-cam.com/video/eHuETf6ygto/w-d-xo.html
What third-party software do you need to do this? My office only has Acrobat Reader and PDF24.
Acrobat DC or Acrobat Pro, please find more info in video description.
Hi! Thank you so much for the video! I am getting Compile error: Method or data member not found, and GetNumPages is highlighted during the line For i = 0 To pdf_doc.GetNumPages - 1. Can you help? I was trying to read from a PDF file. Thank you!
What is your office version and Acrobat version ?
is is the value it return when you debug pdf_doc.GetNumPages ?
@@VBAA2Z I have Office 365 and Acrobat Pro DC, the library is Acrobat 10. The message is “Compile error: Method or data member not found”
I got the code to work by making some adjustments. Is there a limit how complex the PDF file is?
I can open one simple file but I can't open another more complex file. The I have an Adobe Acrobat error: "There was an error opening this document. The file cannot be found" - I know the path is right and the file is where it is supposed to be.
Not sure if this is some limitation with your Acrobat license. It'll be best to post the question in Adobe Acrobat forum.
Thanks for the video. I can't find the code in your links though.
Project is not available for this series so viewers can type out the code themselves.
Hi, I have been doing pdf automation through VBA and did not find the solution or way to upload images to the pdf form programmatically. would you please guide me?
try
Set obj = pdDoc.GetJSObject
obj.getField("image").buttonImportIcon ("E:/sample.jpg")
@@VBAA2Z Thankyou sir.. I will try. For this I have to use button?
that's a buttonImportIcon function / method. let me know how it goes.
Hi. do you know by any chance how you could obtain access to attachments in PDF and save them using VBA?
'm sure there will be a way to accomplish using Acrobat API or other Libraries however I haven't tried it myself.
@@VBAA2Z thanks