repeated
I don't want to select or enable Power point reference ,and need to Merge Shapes but there is Error
I don't want to select or enable Power point reference ,and need to Merge Shapes but there is Error
Code:
Public Sub MangePPTFromExcel()
Dim PPT As Object
Dim Pres As Object
'Dim Sld As Slide' have to go to: Tools --> select Microsoft PowerPoint ? object Library
Dim Sld As Object 'not work with .Shapes.Range(Array("Shpe Name 1", "Shpe Name 2")).MergeShapes (msoMergeCombine)
Dim Names(1 To 2) As Variant
'Dim Shp As PowerPoint.Shape, Rctangl As PowerPoint.Shape, Rctangll As PowerPoint.Shape, MergeShape As PowerPoint.Shape
Dim Shp As Shape, Rctangl As Shape, Rctangll As Shape, MergeShape As Shape
Set PPT = CreateObject("Powerpoint.Application")
Set Pres = PPT.Presentations.Add
'Set Sld = Pres.Slides.Add(1, ppLayoutBlank)
Set Sld = Pres.Slides.Add(1, 12)
With Sld
Set Rctngl1 = .Shapes.AddShape(msoShapeRectangle, 100, 100, 125, 200)
With Rctngl1
.Name = "MyRectangle"
Names(1) = .Name
Lft = .Left
Tp = .Top
End With
' Add Hole
Set Rctngl = .Shapes.AddShape(msoShapeOval, Rctngl1.Left + (Rctngl1.Width * 0.5) - 15, Rctngl1.Top + 15, 30, 30)
With Rctngl
.Name = "Oval"
Names(2) = .Name
End With
Set Shps = .Shapes.Range(Names)
With Shps '.Shapes.Range(Names)
.Select
End With
[COLOR=#ff0000] .Shapes.Range(Array("MyRectangle", "Oval")).MergeShapes (msoMergeCombine) [/COLOR]' works well if declare Sld as Slide, but i need to be worked with Sld As Object
End With
End Sub