


Set wdDoc = (wdFileName) 'open PDF file in WordĪctiveSheet.PasteSpecial Format:="Text" 'optional - pastes whole document for easy checking Set wrd = CreateObject("Word.Application") If wdFileName = False Then Exit Sub '(user cancelled import file browser) "Browse for file containing table to be imported") WdFileName = Application.GetOpenFilename("PDF files,*.pdf,Word files,*.doc*",, _ (Each table in the document will therefore be on a separate worksheet) Sub ImportPDFTable()ĭim iRow As Long, iCol As Integer, iCount As Integer It will create a new worksheet and extract the table contents cell by cell It will paste the document contents to sheet1 (you can remove this) I only have Office XP available right now so this code isn't tested, but something along these lines should work in newer versions.Īsk what Word or PDF file you want tables extracted from You should also be able to check that the values line up properly in the table - if not then the error lies with the original PDF creation, not what you are extracting.

If the PDF file is definitely a table rather than an image of a table, then I would use Word to open the file and extract the data from the Word File to excel.
