Hallo zusammen! Ich habe leider ein Problem mit einem, in der "Tabelle1" hinterlegten, Bild, welches in die Image1 einer Userform geladen werden soll. Mal passt das, mal funktioniert das nicht.
Dim mychart As String
Dim myPicture As String
Dim picHeight As Long
Dim picWidth As Long
Worksheets("Tabelle1").Pictures(1).Select
myPicture = Selection.Name
Charts.Add
ActiveChart.Location where:=xlLocationAsObject, Name:="Tabelle1"
Selection.Border.LineStyle = 0
mychart = Selection.Name & " " & Split(ActiveChart.Name, " ")(2)
With Worksheets("Tabelle1")
With .Shapes(mychart)
.Width = 546
.Height = 102
End With
.Shapes(myPicture).Copy
With ActiveChart
.ChartArea.Select
.Paste
End With
filepath = Environ$("Temp") & "\Chart" & ChNo & ".jpg"
.ChartObjects(1).Chart.Export Filename:=filepath, Filtername:="jpg"
.Shapes(mychart).Cut
End With
Me("Image1").Picture = LoadPicture(filepath)
Kill filepath
|