|
- Private Sub del()
- Dim Rng As Range
- Dim Sht As Worksheet
- ''
- Dim Ppt As PowerPoint.Application
- Dim Pres As Presentation
- Dim Sld As Slide
-
- Set Rng = Selection
- ''
- Set Sht = Rng.Parent
- Set Rng = Sht.Cells(Rng.Row, 1).Resize(Rng.Rows.Count, 1)
- ''
- Set Ppt = New PowerPoint.Application
- Ppt.Visible = msoTrue
- If Ppt.Presentations.Count = 0 Then
- Set Pres = Ppt.Presentations.Add
- Set Sld = Pres.Slides.Add(1, ppLayoutBlank)
- Else
- Set Pres = Ppt.ActivePresentation
- Set Sld = Pres.Slides(1)
- End If
- 'Debug.Print Pres.PageSetup.SlideHeight, Pres.PageSetup.SlideWidth
- For ii = Pres.Slides.Count To 1 Step -1
- Pres.Slides(ii).Delete
- Next ii
- For ii = 1 To Rng.Rows.Count
- Set Sld = Pres.Slides.Add(ii, ppLayoutBlank)
- ExcelInsertPicture Pres, Sld, Rng(ii, 1)
- Next ii
- End Sub
- Function ExcelInsertPicture(Pres As Presentation, Sld As Slide, Rng As Range)
- Debug.Print Sld.Name, Rng.Address, Rng(, 1), Rng(, 2), Rng(, 3)
- Dim Shp 'As Shape
- Set Shp = Sld.Shapes.AddPicture(Rng(, 1), msoFalse, msoTrue, 0, 0, Rng(, 2), Rng(, 3))
- 'Debug.Print Shp.Width, Shp.Height
- With Shp
- .Width = .Width * 0.2
- .Height = .Height * 0.2
- .Top = (Pres.PageSetup.SlideHeight - .Height) / 2
- .Left = 20
- End With
- End Function
复制代码
|
|