I am using the following code to paste a signature image into a cell
This is executed 3 time for 3 different siganture that need to be copied in and is part of a loop of up to 15 set of the 3 signature (min 3, max 45)
The code was debugging sometimes on both the copying of the image and/or the pasting in of the image due to the clipboard being slow so I have tried to use the DoEvents but this hasn't worked.
I don't want to put an Application.Wait in as it may take up to 45 seconds to paste in all the signatures.
This is the full code for the loop
As an attempt to resolve I thought the following would work
But I can't seem to use this to recognise if there is a 'Picure' in the cell.
TIA
VBA Code:
Set shpSig = wsFD.Shapes(strSig)
shpSig.Copy
Range("Output_SigABStart").Offset((intSig - 1) * 5, 0).PastePictureInCell
The code was debugging sometimes on both the copying of the image and/or the pasting in of the image due to the clipboard being slow so I have tried to use the DoEvents but this hasn't worked.
I don't want to put an Application.Wait in as it may take up to 45 seconds to paste in all the signatures.
This is the full code for the loop
VBA Code:
With wsPD
intCount = .Range("PD_Revision")
If intCount = 0 Then
Else
For intSig = 1 To intCount
'Prepared by
strSig = Replace(.Range("PD_PreparedBy").Offset((intSig - 1) * 4, 0), " ", "")
If strSig = "" Then
Else
Set shpSig = wsFD.Shapes(strSig)
DoEvents
shpSig.Copy
DoEvents
Range("Output_SigPBStart").Offset((intSig - 1) * 5, 0).PastePictureInCell
End If
'Checked by
strSig = Replace(.Range("PD_CheckedBy").Offset((intSig - 1) * 4, 0), " ", "")
If strSig = "" Then
Else
Set shpSig = wsFD.Shapes(strSig)
DoEvents
shpSig.Copy
DoEvents
Range("Output_SigCBStart").Offset((intSig - 1) * 5, 0).PastePictureInCell
End If
'Approved by
strSig = Replace(.Range("PD_ApprovedBy").Offset((intSig - 1) * 4, 0), " ", "")
If strSig = "" Then
Else
Set shpSig = wsFD.Shapes(strSig)
DoEvents
shpSig.Copy
DoEvents
Range("Output_SigABStart").Offset((intSig - 1) * 5, 0).PastePictureInCell
End If
Next
End If
End With
As an attempt to resolve I thought the following would work
VBA Code:
Set shpSig = wsFD.Shapes(strSig)
DoEvents
shpSig.Copy
DoEvents
On Error Resume Next
Do Until (Not (Range("Output_SigPBStart").Offset((intSig - 1) * 5, 0) Is Nothing))
Range("Output_SigPBStart").Offset((intSig - 1) * 5, 0).PastePictureInCell
On Error GoTo 0
Loop
But I can't seem to use this to recognise if there is a 'Picure' in the cell.
TIA