copier picture d'un usf dans cellule

jf27

XLDnaute Occasionnel
bjr à tous

voici ce qui marche sur un pc et pas sur un autre (les 2 en vista avec excel 2002SP3)

l'erreur: la méthode paste de la classe worksheet a échoué. Je sèche

Le script pour récupérer l'image et la copier dans une feuille est le suivant:

je compte sur vous car là ca me dépasse ...:eek::confused::mad:
Sheets("Raw_Database").Activate
ActiveSheet.Unprotect
Ligne = Range("A65536").End(xlUp).Row + 1
'Copy image from userform in datasheet at the good place and the good size
Set iPic = Me.photo1.Picture
' Set iPic = Me.imageabstract.Picture
'clipboard opening

OpenClipboard 0&: EmptyClipboard

'Copy image into clipboard

hCopy = SetClipboardData(2, iPic.Handle)

Close clipboard
' CloseClipboard

'Check if something is in clipboard
If hCopy Then
'define where to copy
ActiveCell.Offset(0, 3).Activate

'copy image in the active sheet
ActiveSheet.Paste
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Width = 200
Selection.ShapeRange.Height = 100
Selection.ShapeRange.Rotation = 0#
End If

'Clean variable
DestroyIcon iPic.Handle
Set iPic = Nothing
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
 

Statistiques des forums

Discussions
312 495
Messages
2 088 966
Membres
103 993
dernier inscrit
Essens