DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
With caart.Pek anlamadım ama koddaki her satır arasına bunu koy
deneKod:Application.Wait (Now + TimeValue("00:00:01"))
Yine olmadı.Bir de bunu dene .pasta dan sonra
Kod:Dim basla Dim bekle basla = Timer bekle = 3 While Timer < basla + bekle DoEvents '3 saniye bekle Wend
Option Explicit
Option Compare Text
#If Win64 Then
Private Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Integer) As Long
Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Private Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Integer) As Long
Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long
Private Declare PtrSafe Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As uPicDesc, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Declare PtrSafe Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long
Private Declare PtrSafe Function CopyImage Lib "user32" (ByVal handle As Long, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
#Else
Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Integer) As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Integer) As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As uPicDesc, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Declare Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long
Private Declare Function CopyImage Lib "user32" (ByVal handle As Long, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
#End If
#If VBA7 Then
#Else
#End If
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Type uPicDesc
Size As Long
Type As Long
hPic As Long
hPal As Long
End Type
Const CF_BITMAP = 2
Const CF_ENHMETAFILE = 14
Const IMAGE_BITMAP = 0
Const LR_COPYRETURNORG = &H4
Function PastePicture(Optional lXlPicType As Long = xlPicture) As IPicture
Dim h As Long, hPicAvail As Long, hPtr As Long, hPal As Long, lPicType As Long, hCopy As Long
lPicType = IIf(lXlPicType = xlBitmap, CF_BITMAP, CF_ENHMETAFILE)
hPicAvail = IsClipboardFormatAvailable(lPicType)
If hPicAvail <> 0 Then
h = OpenClipboard(0&)
If h > 0 Then
hPtr = GetClipboardData(lPicType)
If lPicType = CF_BITMAP Then
hCopy = CopyImage(hPtr, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG)
Else
hCopy = CopyEnhMetaFile(hPtr, vbNullString)
End If
h = CloseClipboard
If hPtr <> 0 Then Set PastePicture = CreatePicture(hCopy, 0, lPicType)
End If
End If
End Function
Private Function CreatePicture(ByVal hPic As Long, ByVal hPal As Long, ByVal lPicType) As IPicture
Dim r As Long, uPicInfo As uPicDesc, IID_IDispatch As GUID, IPic As IPicture
With IID_IDispatch
.Data1 = &H7BF80980
.Data2 = &HBF32
.Data3 = &H101A
.Data4(0) = &H8B
.Data4(1) = &HBB
.Data4(2) = &H0
.Data4(3) = &HAA
.Data4(4) = &H0
.Data4(5) = &H30
.Data4(6) = &HC
.Data4(7) = &HAB
End With
With uPicInfo
.Size = Len(uPicInfo)
.Type = IIf(lPicType = CF_BITMAP, 1, 4)
.hPic = hPic
.hPal = IIf(lPicType = CF_BITMAP, hPal, 0)
End With
r = OleCreatePictureIndirect(uPicInfo, IID_IDispatch, True, IPic)
If r <> 0 Then Debug.Print "Create Picture: " & fnOLEError(r)
Set CreatePicture = IPic
End Function
Private Function fnOLEError(lErrNum As Long) As String
Select Case lErrNum
Case &H80004004
fnOLEError = " Aborted"
Case &H80070005
fnOLEError = " Access Denied"
Case &H80004005
fnOLEError = " General Failure"
Case &H80070006
fnOLEError = " Bad/Missing Handle"
Case &H80070057
fnOLEError = " Invalid Argument"
Case &H80004002
fnOLEError = " No Interface"
Case &H80004001
fnOLEError = " Not Implemented"
Case &H8007000E
fnOLEError = " Out of Memory"
Case &H80004003
fnOLEError = " Invalid Pointer"
Case &H8000FFFF
fnOLEError = " Unknown Error"
Case &H0
fnOLEError = " Success!"
End Select
End Function
Sub resimkayıtyap()
Dim Dosya_Adı As String
Dim Say As Long, lPicType As Long, oPic
Klasor = ThisWorkbook.Path
sat = CreateObject("Scripting.FileSystemObject").GetFolder(Klasor).Files.Count
dosyaadi = Klasor & "\" & "Resim" & sat & ".jpg"
If Val(Application.Version) > 11 Then
lPicType = IIf(obMetafile, xlPicture, xlPicture) 'ofis 2007 için
Else
lPicType = IIf(obMetafile, xlPicture, xlBitmap) 'ofis 2003 için
End If
Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
Set oPic = PastePicture(lPicType)
SavePicture oPic, dosyaadi
MsgBox " resim ekleme işi yapıldı"
End Sub
Sub resimkayıtyap1()
Dim Dosya_Adı As String
Dim Say As Long, lPicType As Long, oPic
Klasor = ThisWorkbook.Path
sat = CreateObject("Scripting.FileSystemObject").GetFolder(Klasor).Files.Count
dosyaadi = Klasor & "\" & "Resim" & sat & ".jpg"
lPicType = IIf(obMetafile, xlPicture, xlBitmap)
Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
Set oPic = PastePicture(lPicType)
SavePicture oPic, dosyaadi
MsgBox " resim ekleme işi yapıldı"
End Sub
Sub resimkayıtyap2()
Dim Dosya_Adı As String
Dim Say As Long, lPicType As Long, oPic
Klasor = ThisWorkbook.Path
sat = CreateObject("Scripting.FileSystemObject").GetFolder(Klasor).Files.Count
dosyaadi = Klasor & "\" & "Resim" & sat & ".jpg"
lPicType = IIf(obMetafile, xlPicture, xlPicture)
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set oPic = PastePicture(lPicType)
SavePicture oPic, dosyaadi
MsgBox " resim ekleme işi yapıldı"
End Sub