(Solved) – How to include the mentioned functionalities in the code below

(solved)-–-how-to-include-the-mentioned-functionalities-in-the-code-below

Sub Visual()

Dim PowerPointApp As Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object

If ActiveChart Is Nothing Then
MsgBox “please select chart”
Exit Sub
End If

If PowerPointApp Is Nothing Then _
Set PowerPointApp = CreateObject(class:=”PowerPoint.Application”)

On Error GoTo 0

Application.ScreenUpdating = False

Set myPresentation = PowerPointApp.Presentations.Add

Set mySlide = myPresentation.Slides.Add(1, 11) ’11 = ppLayoutTitleOnly

ActiveChart.ChartArea.Copy

mySlide.Shapes.Paste
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)

myShape.Left = 200
myShape.Top = 200

PowerPointApp.Visible = True
PowerPointApp.Activate

Application.CutCopyMode = False

End Sub

Sub Range()

Dim rng As Range
Dim PowerPointApp As Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object

Set rng = ThisWorkbook.ActiveSheet.Range(“A1:C12”)

On Error Resume Next

  Set PowerPointApp = GetObject(class:="PowerPoint.Application")


  Err.Clear


  If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(class:="PowerPoint.Application")


  If Err.Number = 429 Then
    MsgBox "PowerPoint could not be found, aborting."
    Exit Sub
  End If

On Error GoTo 0

Application.ScreenUpdating = False

Set myPresentation = PowerPointApp.Presentations.Add

Set mySlide = myPresentation.Slides.Add(1, 11) ’11 = ppLayoutTitleOnly

rng.Copy

mySlide.Shapes.PasteSpecial DataType:=2
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)

  myShape.Left = 66
  myShape.Top = 152

PowerPointApp.Visible = True
PowerPointApp.Activate

Application.CutCopyMode = False

End Sub

I want to implement the functionalities as below:
1) In the Sub range, it should ask the user to copy a specified range instead of hard coding it, to copy to the powerpoint
2) In Sub Visual(), it only works for single chart selection in the worksheet, I want it to work for multiple charts selection in the worksheet
3) It should ask the user to copy range or chart into a new ppt or an existing ppt. If existing ppt then specify the path
4) It should ask the user to copy range and chart in the same slide or in a different slide

Leave a Reply

Your email address will not be published. Required fields are marked *