AW: Bild einfügen und Größe/Position anpassen
04.07.2014 08:42:01
fcs
Hallo Benni,
hier ein Makro-Beispiel für das Einfügen einer Grafik-Datei unter PowerPoint.
Falls du unterschiedliche Grafikformate hast, dann müsste man ggf. an einem Filter für den Dialog basteln, der mehrere Grafikformate im Dateidialog anzeigt.
Gruß
Franz
'Erstellt unter PowerPoint 2010
Sub Bild_jpg_Einfuegen()
Dim objShape As Shape, objSlide As Slide
Dim Auswahl As Variant
Set objSlide = Application.ActiveWindow.View.Slide
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Bitte Grafik, die eingefügt werden soll auswählen"
.InitialFileName = "*.jpg"
If .Show = -1 Then
Auswahl = .SelectedItems(1)
Else
Exit Sub
End If
End With
Set objShape = objSlide.Shapes.AddPicture(FileName:=Auswahl, linktofile:=msoFalse, _
savewithdocument:=msoTrue, _
Left:=30, Top:=50, Width:=-1, Height:=-1)
With objShape
.LockAspectRatio = msoTrue
If .Height > 400 Then
.Height = 400
End If
If .Width > 600 Then
.Width = 600
End If
End With
End Sub