Read\Write to PDF Files using Microsoft Excel VBA Programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 พ.ย. 2024

ความคิดเห็น • 73

  • @A7480394
    @A7480394 2 ปีที่แล้ว

    This is exactly the level of explanation I like, this video is great! Thanks!

  • @noahjulianramseur1471
    @noahjulianramseur1471 3 ปีที่แล้ว +1

    Does not work. Keep getting Compile error: Variable not defined. Running excel 2016 on Windows 10.

  • @paulwilson-my1mf
    @paulwilson-my1mf 7 ปีที่แล้ว +1

    Hi Alex,
    Thank you so much for this tutorial, I was trying to do this with sendkeys without too much success.
    I have AdobePro is there a way to SaveAs the file which I have just updated? I have numerous sheets which work off of the same base template pdf document and the saveas ability would be the answer.
    Thanks again for this explanation.

  • @raymonddarazi9283
    @raymonddarazi9283 4 ปีที่แล้ว

    Hello Alex, Thank you so much for this great video / tutorial. It works great but still missing the SAVE. Kindly let us know how to save the PDF file. Thank you, Raymond Darazi

  • @michaeldelicourt731
    @michaeldelicourt731 9 ปีที่แล้ว

    Hi Alex, My version of Acrobat allows me to manually insert a "stamp" inside a pdf document. Would it be possible to automate this manual operation through VBA? thanks

  • @marymadyarova5917
    @marymadyarova5917 6 ปีที่แล้ว

    Alex, Do you know how to get and change coordinates of a specific text (Ex. "Figure 1" in the right coner) on a PDF page. PDF page has only text. I am writing VBA code and cannot figure it out.

  • @jmtiwari5766
    @jmtiwari5766 5 ปีที่แล้ว

    This is exactly what i was looking for.

  • @nolanbunker8065
    @nolanbunker8065 6 ปีที่แล้ว

    Hello Alex, I am currently trying to something similar to your video; however, the code you use in this video will not work for me. What adobe reference(s) do you have selected in the VBA tools. Thank you.

  • @pliniomsann
    @pliniomsann 9 ปีที่แล้ว

    Nice Alex ... with this code can you also read tables inside the pdf doc?
    Thank you in advance

  • @jamisonrobert1
    @jamisonrobert1 4 ปีที่แล้ว

    I can't seem to get this to work with Acrobat DC and Excel 2016. When I run "Dim AcrobatApplication As Acrobat.CAcroApp" I get a message "User-defined type not defined." Any ideas?

  • @tonysparapani3077
    @tonysparapani3077 6 ปีที่แล้ว

    I like your code and i think i would have a use for it, however i tried to use it and it wont work with my 2016 excel. Is there an adaptation that you could share?

  • @vachhanikeyur102
    @vachhanikeyur102 9 ปีที่แล้ว

    Hi Alex, nice video. I want to make a script that automatically adds the links in to single pdf file. For example if I click on the any section mentioned in the index/ table of content, It should get redirected to that same section below in the same PDF. Script (in either VBA or C# or Javascript) without using acrobat is preferred. Can you help me in this?

  • @psrc08
    @psrc08 8 ปีที่แล้ว +2

    Hi Alex, im really stuck at one point of my program, hope that if you have a little time might help, I just want to print several pdf files from a VBA in Excel, but I've tried some codes and different methods to do it but non has done the job, even with the shell command. Do you have any info that I might use? Thanks in advance anyway...

    • @seekknowledge2714
      @seekknowledge2714 6 ปีที่แล้ว

      Mr. Peibol
      You can try the *OpenURL* method or *Thisworkbook.FollowHyperlink* any of them should does the job

  • @eduardomuslimovich9946
    @eduardomuslimovich9946 7 ปีที่แล้ว

    I already have created the forms in PDF, can you make them be written automatically with this code using Adobe Reader?

  • @SixSigmaGuy
    @SixSigmaGuy 10 ปีที่แล้ว

    Hi Alex, nice video. But I'm confused; I see several times in the comments where people ask you about the reference that needs to be added. Why don't you answer them? I have the same question. When I go to the add reference dialog, what reference do I choose from the list? Or which dll, etc., do I have to browse to and add?

    • @alexcantu3
      @alexcantu3  10 ปีที่แล้ว

      Please check description. Thank you for watching. :)

  • @agricambo9112
    @agricambo9112 5 ปีที่แล้ว +1

    Hi Alex, May I get the code in the Module, please?

  • @domzkyofficial7029
    @domzkyofficial7029 6 หลายเดือนก่อน

    Can i copy your code..for easy edit on macros.

  • @chaimaaadnan9491
    @chaimaaadnan9491 4 ปีที่แล้ว

    Thanks a lot Alex 👍🏻

  • @carlbatten4442
    @carlbatten4442 10 ปีที่แล้ว

    Is their still a way to use the macro if you have the Adode master collection?

  • @premkumarramanathan8848
    @premkumarramanathan8848 8 ปีที่แล้ว

    Hi Alex, first of all thanks for putting out a useful video in youtube. I'm running a trial version of Adobe Acrobat Pro DC and Excel 2010 on my system. Despite included Adobe Acrobat 10.0 Type Library into VBA references, I'm seeing that the acrobatapplication in the declaration and statment
    Dim acrobatapplication As Acrobat.CAcroApp
    Set acrobatapplication = CreateObject("AcroExch.App")
    are not changing to proper case and its not working. Please help me out.

  • @premkumarramanathan8848
    @premkumarramanathan8848 8 ปีที่แล้ว

    Hi Alex, can you please help me out with the specific problem I'm facing.

  • @shivamgarg4022
    @shivamgarg4022 8 ปีที่แล้ว

    Hi Alex,
    My program runs successfully for PDF read , but no fields are populated in excel?

  • @rootbeer197
    @rootbeer197 8 ปีที่แล้ว

    thank you Alex for sharing your knowledge soooo useful.
    hugo from québec.

  • @rsmaster5637
    @rsmaster5637 4 ปีที่แล้ว

    Hello! Very Nice Function... There is only one Problem.. When Writing to the PDF ,the PDF Programm Dont Closes at the End of Writing Data To it..
    First i found a Problem That it Stucks on the Save As Promt. After Solving the File Save Issue the PDF Program Stays Open and i have to shut down Manualy ...
    The .Exit Function does Nothing..... Has Anyone the Same Problem or Found a Solution ?

  • @anomaweerasinghe8805
    @anomaweerasinghe8805 7 ปีที่แล้ว

    Hi Alex
    Any program for Nuance PDF converter to extract DATA to an Excel.

  • @r.a.8618
    @r.a.8618 5 ปีที่แล้ว

    I tested it and it actually worked in my computer! Could you please also explain how I can save the PDF file filled in by VBA? I tried both AcrobatDocument.Save and AcrobatDocument.SaveAs but they don't work neither. Instead I got a compile error that said 'Method or data member not found.' I would like to write a for loop program to automate the whole process from filling in the PDF form to saving it as a new file. This is the last and only part where I'm stuck. I would really appreciate if you could give some advise. Thanks.

    • @Lutfitince
      @Lutfitince 5 ปีที่แล้ว

      Good day bro, did you find any solutions?

    • @zahidthakur8725
      @zahidthakur8725 ปีที่แล้ว

      Hi bro..were you able to achieve complete your code. I tried the code mentioned in the mail but instead I am getting a error stating pdf access declined

  • @wendywen8794
    @wendywen8794 7 ปีที่แล้ว

    Super helpful!!!!! Appreciate it!!!!!!!!

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Sorry for mutiple comments.could you show or describe how to add a reference ? Thanks, Joe

  • @raymount6438
    @raymount6438 11 ปีที่แล้ว

    Hi Alex,
    I have the same issue. How do you add this as a reference? I have X Pro.
    Thanks, Ray

  • @neethupaulson4216
    @neethupaulson4216 7 ปีที่แล้ว +1

    Alex i would like to know if its possible to capture data from excel to PDF forms. For example - i have a PDF Doucument already but i need to fill the PDF Form capturring the data from Excel sheet as i enter the details. Is it possible. Please help.

    • @ExcelForFreelancers
      @ExcelForFreelancers 6 ปีที่แล้ว

      Hi, i know that you requested this a long time ago, however I have created a solution for this, that does not require reference libraries or Acrobat Pro here: th-cam.com/video/uU55FCbPHCI/w-d-xo.html

  • @asterion70
    @asterion70 3 ปีที่แล้ว

    Thanks a lot

  • @islahiyette1
    @islahiyette1 5 ปีที่แล้ว

    hi i want write a specific watermark to each pdf page in vba i habe 500 pages

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Alex this video is great but when I put the code in an excel sheet, I get user-defined type not defined on this line Dim AcrobatApplication As Acrobat.CAcroApp. Is there a library i have to add and could you do a step by step on adding the library? Don't know how to email or message on here, but also posted on the page for the group. Don't see it now though. Thanks,Joe

  • @walterkendall170
    @walterkendall170 8 ปีที่แล้ว

    Hi Alex. Great video. I can't find the code in any of the comments. Could you repost? Thanks.

    • @alexcantu3
      @alexcantu3  8 ปีที่แล้ว +1

      Code isn't in comments. Watch the video in 720P to clearly view code. That source is long gone, I don't have it anymore.

    • @Careco1965
      @Careco1965 3 ปีที่แล้ว +1

      Sub WriteAdobeFields()
      'topmostsubform[0].f2_12_0[0]
      'This video shows how to programatically read\write to a PDF file using Microsoft Excel 2010/2007 using PDF API. Using Excel, you can read\write to PDF fields and other controls.
      'Note: Remember to add your Adobe Acrobat Library in the VB Environment. Tools, References, Select the Adobe Acrobat Library. This does require Adobe Pro*
      Dim AcrobatApplication As Acrobat.CAcroApp
      Dim AcrobatDocument As Acrobat.CAcroAVDoc
      Dim fcount As Long
      Dim sFieldName As String

      Set AcrobatApplication = CreateObject("AcroExch.App")
      Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
      If AcrobatDocument.Open("S:\INVOICE SYSTEM For IZ Ready TO USE_New\All_Foms2.pdf", "") Then
      AcrobatApplication.Show
      Set AcroForm = CreateObject("AFormAut.App")
      Set Fields = AcroForm.Fields
      fcount = Fields.Count ' Number of Fields
      Fields("VIN54321").Value = "VIN Baba" ' Works!

      Else
      MsgBox "failure"
      End If

      AcrobatApplication.Exit
      Set AcrobatApplication = Nothing
      Set AcrobatDocument = Nothing
      Set Field = Nothing
      Set Fields = Nothing
      Set ActoForm = Nothing

      End Sub
      Sub ReadAdobeFields()
      row_number = 1
      Dim AcrobatApplication As Acrobat.CAcroApp
      Dim AcrobatDocument As Acrobat.CAcroAVDoc
      Dim fcount As Long
      Dim sFieldName As String

      'On Error Resume Next
      Set AcrobatApplication = CreateObject("AcroExch.App")
      Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
      If AcrobatDocument.Open("S:\INVOICE SYSTEM For IZ Ready TO USE_New\All_Foms2.pdf", "") Then
      AcrobatApplication.Show
      Set AcroForm = CreateObject("AFormAut.App")
      Set Fields = AcroForm.Fields
      fcount = Fields.Count ' Number of Fields

      For Each Field In Fields
      row_number = row_number + 1
      sFieldName = Field.Name
      'MsgBox sFieldName
      Sheet4.Range("B" & row_number) = Field.Name
      Sheet4.Range("C" & row_number) = Field.Value
      'Sheet1.Range("D" & row_number) = Field.Style
      Next Field
      Else
      MsgBox "failure"
      End If

      AcrobatApplication.Exit
      Set AcrobatApplication = Nothing
      Set AcrobatDocument = Nothing
      Set Field = Nothing
      Set Fields = Nothing
      Set ActoForm = Nothing
      End Sub

  • @fortak2006
    @fortak2006 10 ปีที่แล้ว

    Hi Alex
    this tutorial is useful, could you mind sharing the code to me?thank you so much

  • @kansrk2
    @kansrk2 11 ปีที่แล้ว

    I have a huge PDF with 6000 pages that I need to split into multiple PDF files based on page numbers I have listed in an Excel spreadsheet.
    Can I do this using an Excel VB Macro?

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    HI Alex, I used your code to get the names off fields in my document. Instead of looking like the ones you have, mine have names like Debtor.Name, Claim.Amount etc. the values look just like the values in the PDF.When I try your code to write Fields("Debtor.Name").Value = "minnie mouse" I don't get any errors but it won't write to the field. I need to use a variable for my program in the place of the literal "minnie mouse". That doesn't work either. What am I doing wrong?

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Could you show how to set this up in a video?
    Thanks, Joe

  • @lawnside82
    @lawnside82 11 ปีที่แล้ว

    wow that is so cool!!

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Can't fin where to down load development kit on Adobe's website. Can only get reference document.
    can you give a link ?

  • @wesleyab80
    @wesleyab80 11 ปีที่แล้ว

    great video! One more help: I need it to call the pdf to open in Adobe Reader and not Acrobat. That means I need to "Set AcrobatApplication = CreateObject("???????") and "Set AcrobatDocument = CreateObject("???????") Help!

  • @andyjin7257
    @andyjin7257 9 ปีที่แล้ว

    Hi Alex. Nice video. Could you share your code?

  • @taimoorkhan8203
    @taimoorkhan8203 7 ปีที่แล้ว

    how can i insert a water mark in to a PDF document created by a macro

  • @vijayaganeshv5766
    @vijayaganeshv5766 6 ปีที่แล้ว

    What is the variable assigned for Fields

  • @ravipunai6767
    @ravipunai6767 11 ปีที่แล้ว

    I cannot get the code to compile. I keep getting user-defined type not defined.
    I am using Acrobat x Pro

    • @davidfunvideos
      @davidfunvideos 9 ปีที่แล้ว +1

      +Ravi Punai did you ever find a solution to this? I am having the same trouble?

  • @peterschwarz7526
    @peterschwarz7526 11 ปีที่แล้ว

    Hi,
    thanks for the files.
    after loading in the references to adobe, i'm getting an error on this line of code...
    If AcrobatDocument.Open(filepath & datafile, "") Then
    the error is "object variable or with block variable not set" run-time error 91
    any help would be appreciated.
    peter

  • @simao0505
    @simao0505 4 ปีที่แล้ว

    Is Adobe Pro for free?

  • @brianduran3676
    @brianduran3676 10 ปีที่แล้ว +1

    Where can i get the code that your wrote?

    • @Careco1965
      @Careco1965 3 ปีที่แล้ว

      Sub WriteAdobeFields()
      'topmostsubform[0].f2_12_0[0]
      'This video shows how to programatically read\write to a PDF file using Microsoft Excel 2010/2007 using PDF API. Using Excel, you can read\write to PDF fields and other controls.
      'Note: Remember to add your Adobe Acrobat Library in the VB Environment. Tools, References, Select the Adobe Acrobat Library. This does require Adobe Pro*
      Dim AcrobatApplication As Acrobat.CAcroApp
      Dim AcrobatDocument As Acrobat.CAcroAVDoc
      Dim fcount As Long
      Dim sFieldName As String

      Set AcrobatApplication = CreateObject("AcroExch.App")
      Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
      If AcrobatDocument.Open("S:\INVOICE SYSTEM For IZ Ready TO USE_New\All_Foms2.pdf", "") Then
      AcrobatApplication.Show
      Set AcroForm = CreateObject("AFormAut.App")
      Set Fields = AcroForm.Fields
      fcount = Fields.Count ' Number of Fields
      Fields("VIN54321").Value = "VIN Baba" ' Works!

      Else
      MsgBox "failure"
      End If

      AcrobatApplication.Exit
      Set AcrobatApplication = Nothing
      Set AcrobatDocument = Nothing
      Set Field = Nothing
      Set Fields = Nothing
      Set ActoForm = Nothing

      End Sub
      Sub ReadAdobeFields()
      row_number = 1
      Dim AcrobatApplication As Acrobat.CAcroApp
      Dim AcrobatDocument As Acrobat.CAcroAVDoc
      Dim fcount As Long
      Dim sFieldName As String

      'On Error Resume Next
      Set AcrobatApplication = CreateObject("AcroExch.App")
      Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
      If AcrobatDocument.Open("S:\INVOICE SYSTEM For IZ Ready TO USE_New\All_Foms2.pdf", "") Then
      AcrobatApplication.Show
      Set AcroForm = CreateObject("AFormAut.App")
      Set Fields = AcroForm.Fields
      fcount = Fields.Count ' Number of Fields

      For Each Field In Fields
      row_number = row_number + 1
      sFieldName = Field.Name
      'MsgBox sFieldName
      Sheet4.Range("B" & row_number) = Field.Name
      Sheet4.Range("C" & row_number) = Field.Value
      'Sheet1.Range("D" & row_number) = Field.Style
      Next Field
      Else
      MsgBox "failure"
      End If

      AcrobatApplication.Exit
      Set AcrobatApplication = Nothing
      Set AcrobatDocument = Nothing
      Set Field = Nothing
      Set Fields = Nothing
      Set ActoForm = Nothing
      End Sub

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    I was wondering if you could give the code for saving the PDF under a different name to a different dir after we fill it in.
    AcroExch.AVDoc doesn't seem to have a save method because I get methos not found. Seems like it has an open it should have a save.

    • @r.a.8618
      @r.a.8618 5 ปีที่แล้ว

      Hi, I would also like to know how to save as a new file. If you found a solution to this, could you please share? Thanks a lot.

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Ok, found out the problem was moving it to another directory even though I copied the SDK File to the same directory

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Never mind see now that you have to register with adobe to download the sdk.

  • @AndresDiaz-pf8ve
    @AndresDiaz-pf8ve 11 ปีที่แล้ว

    Hi Alex,
    I used your code and when I run the the macro, VB gives me an error. "Compile error: User-defined type not defined". After clicking "OK" it highlights:AcrobatApplication As Acrobat.CAcroApp.
    I like the idea of using this macro. Pleeeeease HELP.
    Thanks,

    • @nolanbunker8065
      @nolanbunker8065 6 ปีที่แล้ว

      I ran into the same issue, was there any fix to this?

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Nevermind about the question see now you have to regiseter with adobe to down load the SDK

  • @yuxie5743
    @yuxie5743 6 ปีที่แล้ว

    how can I find the code?

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Nevermind see you have to register to download

  • @blakemaster5054
    @blakemaster5054 5 ปีที่แล้ว

    Hi may I ask you please

  • @JoeCoolCols
    @JoeCoolCols 11 ปีที่แล้ว

    Never mind see you have to sign up first