VBA代码将PDF转换为Txt(Adobe Acrobat XI Pro)

我需要帮助编写代码让我的vba代码自动转换PDF到TXT。 目前我的代码要求文件为“txt”格式,我希望能够上传PDF并将其转换为txt文件。

'Get The Data EnterData: CurrentSheet = ActiveSheet.Name 'Application.ScreenUpdating = False Dim myObj As Object Dim myDirString As String Set myObj = Application.FileDialog(msoFileDialogFilePicker) With myObj .InitialFileName = "C:\Users\" & Environ$("Username") & ".domain\Documents" .Filters.Clear .Filters.Add "Text Files", "*.txt", 1 If .Show = False Then MsgBox "Please select TXT file.", vbExclamation: Exit Sub myDirString = .SelectedItems(1) End With Sheets.Add With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;" & myDirString, Destination:=Range("$A$1")) .Name = "TxtImport" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 1252 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(2, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With 'rest of the formatting codes here Range("B1") = "=MATCH(""CSYS:"",A:A,0)" dDate = Range("C2") DataStart = Range("B1") + 1 Range(Cells(DataStart, 1), Cells(DataStart + 24, 2)).Copy Worksheets("ImplementationSheet").Range("A1:B25") Application.DisplayAlerts = False ActiveSheet.Delete Application.DisplayAlerts = True Worksheets("ImplementationSheet").Activate Worksheets("ImplementationSheet").Range("A1:B25").Select ActiveWorkbook.Worksheets("ImplementationSheet").Sort.SortFields.Clear ActiveWorkbook.Worksheets("ImplementationSheet").Sort.SortFields.Add Key:= _ Worksheets("ImplementationSheet").Range("A2:A25"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortTextAsNumbers With ActiveWorkbook.Worksheets("ImplementationSheet").Sort .SetRange Worksheets("ImplementationSheet").Range("A1:B25") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Worksheets("ImplementationSheet").Range("A1").Select Worksheets("ImplementationSheet").Range("F1") = dDate Worksheets(CurrentSheet).Activate Application.ScreenUpdating = True NewOrExistingVolute.Show End Sub 

我需要帮助编写代码让我的vba代码自动转换PDF到TXT。 目前我的代码要求文件为“txt”格式,我希望能够上传PDF并将其转换为txt文件。