Sub mTest()
Dim strPath$
strPath = ActiveWorkbook.Path
ExtractImgPDF "C:\Users\Documents\test.pdf", strPath
End Sub
Private Sub ExtractImgPDF(ByVal PathPDF As String, ByVal DestPath As String)
Dim i&, lRet&, j&, lCount&, FF%, sBuff$, sStream$, imgstrt$
Dim ArrStream() As String
lCount = 1
FF = FreeFile
Open PathPDF For Binary As #FF
sBuff = Space(LOF(FF))
Get #FF, , sBuff
Close #FF
If Right$(DestPath, 1) <> "\" Then DestPath = DestPath & "\"
imgstrt = "ÿØÿ"
ArrStream = Split(sBuff, imgstrt)
For i = 1 To UBound(ArrStream)
lRet = InStr(ArrStream(i), "endstream")
If lRet Then
sStream = imgstrt & Left$(ArrStream(i), lRet - 1)
FF = FreeFile
Open DestPath & "Image " & lCount & ".jpg" For Binary As #FF
Put #FF, , sStream
Close #FF
lCount = lCount + 1
Else
Debug.Print Left$(sStream, 6)
End If
Next
End Sub