Batch Insert Figures Into Powerpoint Slides with VBA I have a series of images (&quot;1.bmp&quot;, &quot;2.bmp&quot;, &quot;3.bmp&quot;,... ,&quot;30.bmp&quot; in &quot;F:\Images&quot; folder) and I am trying to insert these images one by one into Microsoft PowerPoint with VBA program. The base slide (as template) has been set down in page 2. The image object which is named Image1 in that template slide is going to be replaced into &quot;F:\Images\1.bmp&quot;, &quot;F:\Images\2.bmp&quot;... separately in new slides after the base slide.
The experimental implementation
The main entry method is InsertFigures.
Sub InsertFigures()
    'Reference: (Show object name) https://stackoverflow.com/a/52088805
    'Reference: (Replace image) https://stackoverflow.com/a/18083223
    
    Dim BaseSlideNumber As Integer
    Dim StartNum, EndNum As Integer
    StartNum = 1
    EndNum = 30
    BaseSlideNumber = 2
    Dim LoopNumber As Integer
    For LoopNumber = StartNum To EndNum
      Set newSlide = ActivePresentation.Slides(BaseSlideNumber).Duplicate
    Next LoopNumber
    
    For LoopNumber = StartNum To EndNum
        NewPictureFilename = &quot;F:\Images\&quot; &amp; CStr(LoopNumber) &amp; &quot;.bmp&quot;  ' Source Image Path
        Dim TargetSlideNumber As Integer
        TargetSlideNumber = BaseSlideNumber + (LoopNumber - StartNum + 1)
        Set ObjectForGettingProperties = getShapeByName(&quot;Image1&quot;, TargetSlideNumber)
        'Capture properties of exisitng picture such as location and size
        With ObjectForGettingProperties
            TopProperty = .Top
            LeftProperty = .Left
            HeightProperty = .Height
            WidthProperty = .Width
            'SoftEdgeProperty = .SoftEdge
        End With
        ObjectForGettingProperties.Delete                       ' Delete origin placeholder
        
        Set NewImageObject = ActivePresentation.Slides(TargetSlideNumber).Shapes.AddPicture(NewPictureFilename, msoFalse, msoTrue, LeftProperty, TopProperty, WidthProperty, HeightProperty)
        NewImageObject.Name = &quot;NewImage&quot;                  ' Set image name
        NewImageObject.SoftEdge.Radius = 8.86
    Next LoopNumber
    
    
End Sub

Function getShapeByName(shapeName As String, Slide As Integer)
    'Reference: https://stackoverflow.com/a/5527604
    Set getShapeByName = ActivePresentation.Slides(Slide).Shapes(shapeName)
End Function


All suggestions are welcome.
Overall, there's not much to comment on for the code logic -- it does what you need it to do. But there are some details to pay attention to that will help in this and future code.

Always use Option Explicit. There are a couple of undeclared variables/objects in your code that leads me to believe this directive is not present. Turn it on and leave it on.
Be careful when declaring multiple variables on a single line.

In your code where you have
Dim StartNum, EndNum As Integer

Then StartNum will be a Variant and EndNum will be an Integer, which is not exactly what you want. It might be a pain, but save yourself and declare each variable on a separate line (once it's a habit, it's not as bad as you think).

Declare your number variables as Long, not Integer. This answer gives a very detailed explanation, but just know it's considered a &quot;best practice&quot; to always use Long.
This point is more of a stylistic convention, but it's considered &quot;standard&quot; (personal preferences apply) to declare variables with camelCase and procedure names with PascalCase and constants with SHOUTY_SNAKE_CASE (reference). If you read that reference, PLEASE don't fall down the Hungarian case rabbit hole. (These conventions can lead to highly entertaining comments and emotional battles about the merits of these conventions. Do what I do:  get some popcorn and enjoy the show ;) )
Pay attention to the arguments in your functions or subs and identify each parameters as ByRef or ByVal. Microsoft explains the difference (using Visual Basic, but it's essentially the same in VBA), and there are other good references to read to learn more about it.
This is really my own personal preference, but I do try to limit the line length of each statement to around 80 characters. It it's longer, I add the continuation character. This is more of a guideline than a hard rule (for me), but it does make code easier to read.

The example below is my implementation of your code, as modified by my comments.
Option Explicit

Sub InsertFigures()
    'Reference: (Show object name) https://stackoverflow.com/a/52088805
    'Reference: (Replace image) https://stackoverflow.com/a/18083223
    
    Dim baseSlideNumber As Long
    Dim startNum As Long
    Dim endNum As Long
    startNum = 1
    endNum = 30
    baseSlideNumber = 2
    
    Dim loopNumber As Long
    Dim newSlide As SlideRange
    For loopNumber = startNum To endNum
      Set newSlide = ActivePresentation.Slides(baseSlideNumber).Duplicate
    Next loopNumber
    
    For loopNumber = startNum To endNum
        Dim newPictureFilename As String
        Dim targetSlideNumber As Long
        newPictureFilename = &quot;F:\Images\&quot; &amp; CStr(loopNumber) &amp; &quot;.bmp&quot;  ' Source Image Path
        targetSlideNumber = baseSlideNumber + (loopNumber - startNum + 1)
        
        Dim topProperty As Double
        Dim leftProperty As Double
        Dim heightProperty As Double
        Dim widthProperty As Double
        Dim softEdgeProperty As Double
        
        'Capture properties of exisitng picture such as location and size
        Dim objectForGettingProperties As Shape
        Set objectForGettingProperties = GetShapeByName(&quot;Image1&quot;, targetSlideNumber)
        With objectForGettingProperties
            topProperty = .Top
            leftProperty = .Left
            heightProperty = .Height
            widthProperty = .Width
            'SoftEdgeProperty = .SoftEdge
        End With
        objectForGettingProperties.Delete           ' Delete origin placeholder
        
        Dim newImageObject As Object
        Set newImageObject = ActivePresentation.Slides(targetSlideNumber) _
                                     .Shapes.AddPicture(newPictureFilename, _
                                                        msoFalse, msoTrue, _
                                                        leftProperty, _
                                                        topProperty, _
                                                        widthProperty, _
                                                        heightProperty)
        newImageObject.Name = &quot;NewImage&quot;        'Set image name
        newImageObject.SoftEdge.Radius = 8.86
    Next loopNumber
End Sub

Function GetShapeByName(ByVal shapeName As String, ByVal Slide As Long) As Shape
    'Reference: https://stackoverflow.com/a/5527604
    Set GetShapeByName = ActivePresentation.Slides(Slide).Shapes(shapeName)
End Function