I need help with this code. The code runs as it should from excel converter pdf to word, however when I open the word document I will find on some pages the last sentence of a paragraph has been moved from it’s original table location and placed to the bottom of the page to which the table is on.
Each page contains two Columns with subject being in the first containing a couple of words, and free text in the second containing a paragraph of text to which I have the problem. Any ideas on something I could do in below code to rectify it?
Code
Sub PDF_To_Word()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.DisplayStatusBar = True
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Interface")
Dim pdf_path As String
Dim word_path As String
pdf_path = sh.Range("Q12").Value
word_path = sh.Range("Q12").Value
Dim fso As New FileSystemObject
Dim fo As Folder
Dim f As File
Set fo = fso.GetFolder(pdf_path)
Dim wa As Object
Dim doc As Object
Set wa = CreateObject("word.application")
wa.Visible = True
Dim file_Count As Integer
For Each f In fo.Files
Application.StatusBar = "Converting - " & file_Count + 1 & "/" & fo.Files.Count
Set doc = wa.Documents.Open(f.Path)
doc.SaveAs2 (word_path & "\" & Replace(f.Name, ".pdf", ".docx"))
doc.Close False
file_Count = file_Count + 1
Next
wa.Quit
Kill "D:\My Documents\VBA\Test folder\*.pdf*"
End Sub
Display More