DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub ExtractPDFs()
Dim dst, oShell As Object, obj As OLEObject, ws As Worksheet
dst = Environ$("userprofile") & "\Desktop\ExtractedPDFs"
If Dir(dst, vbDirectory) = "" Then
MkDir dst
Else
If Dir(dst & "\*.*") <> "" Then Kill dst & "\*.*"
End If
Set oShell = CreateObject("Shell.Application").Namespace(dst).Self
For Each ws In ThisWorkbook.Worksheets
If Not ws.Visible Then ws.Visible = True
For Each obj In ws.OLEObjects
obj.Copy
oShell.InvokeVerb "Paste"
Next
Next
MsgBox "İşlem yapıldı"
End Sub
Option Explicit
'Note: the extracted PDF files should open in Microsoft Edge _
They will not open in Acrobat reader
Sub ExtractPDF()
Dim FName As Variant
Dim TmpPath As Variant
Dim FSO As Object
Dim oApp As Object
Dim sPath As String
Dim Output As String
Dim f As String
Dim i As Long, j As Long
Dim ftype As String
'Set location and output; adjust as required
sPath = "C:\XXX\"
Output = "PDFfile" & Format(Now, " yy_mm_dd_hh_mm")
ftype = ".pdf"
'Create Objects
Set FSO = CreateObject("scripting.filesystemobject")
Set oApp = CreateObject("Shell.Application")
'Set paths and create folders
TmpPath = sPath & "MyUnzipFolder"
FName = sPath & "Data.zip"
On Error Resume Next
FSO.deletefolder TmpPath
FSO.deletefolder sPath & "PDF" 'Deletes previously extracted files
MkDir sPath & "PDF"
MkDir TmpPath
On Error GoTo 0
'Make copy of workbook as zip file
ActiveWorkbook.SaveCopyAs FName
'Unzip bin files
For j = 1 To oApp.Namespace(FName).items.Count
oApp.Namespace(TmpPath).CopyHere oApp.Namespace(FName).items.Item("xl\embeddings\oleObject" & j & ".bin")
f = TmpPath & "\oleObject" & j & ".bin"
If Len(Dir(f)) = 0 Then Exit For
Name f As sPath & "PDF\" & Output & Format(j, " - 00") & ftype
Next j
'Clean up and view files
FSO.deletefolder TmpPath
Shell "explorer.exe " & sPath & "PDF", vbNormalFocus
End Sub