首页 > 解决方案 > how to RESIZE the imported picture with factor scaling using VBA in powerpoint 2016?

问题描述

this script imports the image from a random folder and place it on current slide. But I need to resize or rescaling with factors (0% to 100%) . Please help me on addition to this script...

'''

Sub insert_pic()

Dim osld As Slide
Dim oFD As FileDialog
Dim sFile As String
Dim opic As Shape
Dim sFolder As String


Set osld = ActiveWindow.View.Slide
Set oFD = Application.FileDialog(msoFileDialogFilePicker)
sFolder = "C:\Autodesk\iNSERT_iMAGE\"
With oFD
.InitialFileName = sFolder
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Pictures", "*.EMF, *.PNG ,*.BMP"
If .Show = msoTrue Then sFile = .SelectedItems(1)
End With
If sFile <> "" Then
Set opic = osld.Shapes.AddPicture(FileName:=sFile, _
Top:=15, _
Left:=0, _
Height:=True, _
Width:=True, _
LinKToFile:=msoFalse, _
SaveWithDocument:=msoTrue)

End If

End Sub

'''

标签: vbaresizescaling

解决方案


推荐阅读