Je crois avoir trouvé :
ActiveSheet.Paste Destination:=ActiveSheet.Range("E6")
Cependant, je dois faire face à un autre problème :
J'ai une fonction myplot_2 que j'appelle dans Excel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Function myplot_2(Optional x As Variant, Optional y As Variant, _
Optional width As Variant, _
Optional height As Variant) As Variant
On Error GoTo Handle_Error
Call InitModule
If Myplot_20 Is Nothing Then
Set Myplot_20 = CreateObject("myplot_2.Myplot_2.1_0")
End If
Call Myplot_20.myplot_2(x, y, width, height)
myplot_2 = Empty
ActiveSheet.Paste Destination:=ActiveSheet.Range("E6")
Exit Function
Handle_Error:
myplot_2 = "Error in " & Err.Source & ": " & Err.Description
End Function |
Cette function crée une image qui est copiée dans le clipboard.
En incluant la ligne ActiveSheet.Paste Destination:=ActiveSheet.Range("E6") dans ma function, j'espère voir mon image collée dans ma feuille Excel. Or rien ne se passe.
Par contre, après avoir executé ma function myplot_2, si j'exécute la macro suivante, mon image est bien collé dans ma feuille Excel.
1 2 3 4 5
| Sub paste_image()
ActiveSheet.Paste Destination:=ActiveSheet.Range("E6")
End Sub |
Question : pourquoi lorsque j'appelle la function myplot_2, la ligne de commande ActiveSheet.Paste Destination:=ActiveSheet.Range("E6") est ignorée ?
Cordialement,
RM
Partager