Link to home
Start Free TrialLog in
Avatar of Veena Raju
Veena Raju

asked on

Convert all PDF to word at once

Do we have a VBA to convert all PDF's that are there in the particular PDF to word  along with the track changes, review comments or text comments, stamps in the PDF to word ?

If yes, please share the VBA code. this will be my life saver
Avatar of Hello There
Hello There

See this. https://www.myengineeringworld.net/2013/03/vba-macro-to-convert-pdf-files-into.html
But I'm skeptical. PDFs are hard to convert to any format in bulk with keeping its formatting.

along with track changes, review comments or text comments, stamps in the PDF to word
I tried to find the way how to do it for my purposes but no success. Yes, you can find many tools, VBA codes etc. but it will not do the job. It will convert it with broken formatting.
I personally did not try to use the commercial third party tool so you can...

There is a VBA code that works in 2013 version and later. Still I am not sure it will do all you want. Try it anyway.
Sub convertToWord()
   Dim MyObj As Object, MySource As Object, file As Variant
   file = Dir("D:\OfficeDev\Word\201505\Pdf\" & "*.pdf") 'pdf path
   Do While (file <> "")
   ChangeFileOpenDirectory "D:\OfficeDev\Word\201505\Pdf\" 
          Documents.Open FileName:=file, ConfirmConversions:=False, ReadOnly:= _
        False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
        "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
        Format:=wdOpenFormatAuto, XMLTransform:=""
    ChangeFileOpenDirectory "D:\OfficeDev\Word\201505\Pdf\Word"'path for saving word
    ActiveDocument.SaveAs2 FileName:=Replace(file, ".pdf", ".docx"), FileFormat:=wdFormatXMLDocument _
        , LockComments:=False, Password:="", AddToRecentFiles:=True, _
        WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
         SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
        False, CompatibilityMode:=15
    ActiveDocument.Close
     file = Dir
   Loop
End Sub

Open in new window

Avatar of Veena Raju

ASKER

Hi,

Am not able to run this VBA either on excel or on word. the run button on VBA screen for this code is not working.
Check the path... source and destination...

But as I said I am not sure if it works.
No its not working. am not able to convert the PDF to word file
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.