9/9/2023 0 Comments Excel import pdf tableImporthtml is not an Excel formula/function I am familiar with. 'copy cell contents from Word table cells to Excel cellsĬells(iRow, iCol) = WorksheetFunction.Clean(.cell(iRow, iCol).Range.Text)ĮDIT: Almost forgot the last part of your query. If TableNo = 0 Then MsgBox "This document contains no tables", vbExclamation, "Import Word Table" 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |