如何在Mac上将PDF转换为Excel?
我有很多PDF文件要转换成excel。我找到了下面的代码,它通过在word中打开PDF文件将PDF转换为excel,但在Dim fso作为新的FileSystemObject时失败,因为mac excel没有脚本字典。如何修改代码以在word中打开PDF文件而不必使用脚本字典如何在Mac上将PDF转换为Excel?,excel,vba,macos,pdf,ms-word,Excel,Vba,Macos,Pdf,Ms Word,我有很多PDF文件要转换成excel。我找到了下面的代码,它通过在word中打开PDF文件将PDF转换为excel,但在Dim fso作为新的FileSystemObject时失败,因为mac excel没有脚本字典。如何修改代码以在word中打开PDF文件而不必使用脚本字典 Option Explicit Sub pdf_to_excel() Dim setting_sh As Worksheet Set setting_sh = ThisWorkbook.Sheets("Setting")
Option Explicit
Sub pdf_to_excel()
Dim setting_sh As Worksheet
Set setting_sh = ThisWorkbook.Sheets("Setting")
Dim pdf_path As String
Dim excel_path As String
pdf_path = setting_sh.Range("E11").Value
excel_path = setting_sh.Range("E12").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
Dim wr As Object
Set wa = CreateObject("word.application")
wa.Visible = True
Dim nwb As Workbook
Dim nsh As Worksheet
For Each f In fo.Files
Set doc = wa.documents.Open(f.Path, False, Format:="PDF files")
Set wr = doc.Paragraphs(1).Range
wr.WholeStory
Set nwb = Workbooks.Add
Set nsh = nwb.Sheets(1)
wr.Copy
nsh.Paste
nwb.SaveAs (excel_path & "\" & Replace(f.Name, ".pdf", ".xlsx"))
doc.Close False
nwb.Close False
Next
wa.Quit
MsgBox "Done"
End Sub
还有其他不需要编程的方法。一个是使用该应用程序。这个应用并不便宜,但如果你在链接的网站上向下滚动,它是一个免费下载选项。其中一个提供了其他方法,可以将您的PDF转换为excel,但该网站对PDF文件的大小有很大的限制。如果您感兴趣,可以使用非编程选项来完成此操作。@jmh我感兴趣。