0

I've issue right now to find highest values in PDF file that was extracted to excel cells. The Values usually is certain format which is in currency.

Example ; Value : 2,003.00 / 2.122,00 / 812.00 / 812,00

is it possible to find this highest values in specific format and also rename the pdf file according to the value?

i only have code for extracting data in pdf to excel.

 Sub pdftestlatest()
    
Dim InitialFolder As String, FullName As Variant, ShtPdfData As Worksheet
Dim wdApp As Object, wdPdfDoc As Object, wdRange As Object

InitialFolder = Environ("userprofile") & "\Downloads\"
ChDrive Left(InitialFolder, 1)
ChDir InitialFolder
FullName = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf", 1)

If Not VarType(FullName) = vbBoolean Then

    Set wdApp = CreateObject("Word.Application")
    wdApp.Visible = True

    Set wdPdfDoc = wdApp.Documents.Open(filename:=FullName, ConfirmConversions:=False, ReadOnly:=False, Format:=0, NoEncodingDialog:=True)
    Set wdRange = wdPdfDoc.Range(1)
    wdRange.WholeStory
    wdRange.Copy

    Set ShtPdfData = ThisWorkbook.Worksheets("Sheet1")
    Application.Goto ShtPdfData.Range("A1")
    ShtPdfData.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True


    wdPdfDoc.Close False
    wdApp.DisplayAlerts = False
    wdApp.Quit

Else
    'cancel was pressed
End If
End sub

Here is the example of PDF and excel PDF

EXCEL

sephiroth
  • 43
  • 7
  • 1
    What do you mean by "highest format values"? So, you have numbers with different thousand and decimal separators. Are they in a table or not? It would be good to edit your question and place a picture of the pdf page. Do you succeed placing them in Excel (using the above code)? If yes, what format do you obtain copying as "HTML" format? – FaneDuru Mar 10 '23 at 07:59
  • Hi @FaneDuru, the picture of pdf and excel has been updated, – sephiroth Mar 10 '23 at 13:01
  • You updated but you did not clarify anything (except placing the pictures, which makes more confusion than clarification...). I cannot see different decimal/thousand separators, you did not say anything about the format etc. Should be the value to be extracted the last one in "E:E" column? "A:A" column? The "highest value" from the sheet? The "highest value" between some more such files? We are not mind readers... Your question can offer something reproductible. How to understand all these aspects if you do not clarify them **in your question**? Am I missing anything? – FaneDuru Mar 10 '23 at 14:55

0 Answers0