Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vinicius_siquei
Partner - Contributor III
Partner - Contributor III

Export to PPT

Folks,

I´m using the macro below to export charts to PowerPoint, however I´m having issues with the parameters used for positioning.

Sub Export2PPT_IndividualCharts

Set PPApp = CreateObject("Powerpoint.Application")

PPApp.Visible = True ' Create a presentation

Set PPPres = PPApp.Presentations.Add

Set PPSlide = PPPres.Slides.Add(1, 1)

PPSlide.Shapes(1).Delete ' removes the title

PPSlide.Shapes(1).Delete ' removes the text box

ActiveDocument.GetSheetObject("CH198").CopyBitmapToClipboard

ActiveDocument.GetApplication.WaitForIdle

  with PPSlide.Shapes.Paste

      .Left  = 150

      .Top  = 50

      .Width = 150

      .Height = 450

     end with

PPPres.SaveAs "C:\Individual.ppt" 'comment this if you dont want ppt to close automatically

PPPres.Close          'comment this if you dont want ppt to close automatically

PPApp.Quit      'comment this if you dont want ppt to close automatically

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub

I´m receiving expected object error message for

.Left  = 150

.Top  = 50

.Width = 150

.Height = 450


Any Ideas of what can be done to solve this problem ?

1 Solution

Accepted Solutions
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

could be that you have to add a with ?

with PPSlide.Shapes.Paste

  With .Shapes(.Shapes.Count)

    .Left = 50

    .Top = 100

    .Width = 600

    .Height = 400

  End With

End With

View solution in original post

3 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

could be that you have to add a with ?

with PPSlide.Shapes.Paste

  With .Shapes(.Shapes.Count)

    .Left = 50

    .Top = 100

    .Width = 600

    .Height = 400

  End With

End With

vinicius_siquei
Partner - Contributor III
Partner - Contributor III
Author

I also get success by using :

with PPSlide.Shapes.Paste
           PPSlide.Shapes(PPSlide.Shapes.Count).Left = 825
           PPSlide.Shapes(PPSlide.Shapes.Count).Top = 430
      end with

AbhijitBansode
Specialist
Specialist

It is not working in webview mode.