Ich möchte gerne diese Funktion aus Word aufrufen um die Grafik entsprechend zu speichern und dann in das Word Dokument einzubinden.
Public Sub Bild_als_Grafik_speichern()
Dim MeinBild As ChartObject, MeinRahmen As Shape
Dim Gefunden As Boolean
Application.ScreenUpdating = False
Sheets("Tabelle1").Activate
For Each MeinRahmen In ActiveSheet.Shapes
If MeinRahmen.Type = msoPicture Then Gefunden = True: Exit For
Next
If Gefunden Then
MeinRahmen.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Worksheets.Add
Set MeinBild = ActiveSheet.ChartObjects.Add(0, 0, MeinRahmen.Width, MeinRahmen.Height)
With MeinBild
.Activate
.Chart.Paste
.Chart.Export fileName:="C:\Users\z003d1uj\Pictures\Saved Pictures\Test3.jpg", FilterName:="JPG", Interactive:=False
End With
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
Set MeinBild = Nothing
Set MeinRahmen = Nothing
Application.ScreenUpdating = True
End If
End Sub
|