Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export multiple objects to a single powerpoint slide

Can anyone provide sample code for a macro to export multiple objects into a single powerpoint slide.

Looks like there are no previous discussions regarding this topic.

All the discussions only tell about pasting a single object per slide.

I would really appreciate it, if someone sheds light on this topic.

Thanks,

Bharath

24 Replies
Not applicable
Author

Hi,

Is there a possibility to export only selective charts from a sheet to PPT.

And this has to be dynamic, like every time when i need copy only 2/3 charts from a sheet having more than 5 charts. Please help out. Thanks for the help,

Not applicable
Author

Hi Eric,

Thanks for the helpful snippet.

Was wondering how can we copy/paste objects from different sheets ona  different slides.

I tried the following but it is copying the objects from sheet(SH05) only, though sheet (SH04) get activated but the code is not coying the objects from sheet (SH04). The clipboard have still object from sheet (SH05).

Again thanks in advance:

Sub ExportPPT
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
Set PPSlide = objPresentation.Slides.Add(1,11)

set up = ActiveDocument.GetApplication.GetUserPreferences
up.ChartUseCapNBorder = True
ActiveDocument.GetApplication.SetUserPreferences up


with objPresentation.Slides(1).Shapes(1)
.TextFrame.TextRange = "Supervisory Controls"


'.Left = 100
'.top = 100
'.width=75
'.height=25
end with
ActiveDocument.Sheets("SH05").Activate
ActiveDocument.GetSheetObject("CH23").CopyBitmapToClipboard

with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 125
.width=400
.height=150
end with
ActiveDocument.GetSheetObject("CH25").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 300
.width=100
.height=125
end with
ActiveDocument.GetSheetObject("CH26").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 300
.width=100
.height=125
end with

Set PPSlide = objPresentation.Slides.Add(2,11)
with objPresentation.Slides(2).Shapes(1)
.TextFrame.TextRange = "Resource Forecasting"
end with


ActiveDocument.ActivateSheetByID "SH04"
'ActiveDocument.Sheets("SH04").Activate
ActiveDocument.GetSheetObject("CH22").CopyBitmapToClipboard
objPresentation.Slides(2).select
with objPresentation.Slides(2).Shapes.Paste
.Left = 100
.top = 125
.width=400
.height=150
end with

ActiveDocument.GetSheetObject("CH28").CopyBitmapToClipboard

with objPresentation.Slides(2).Shapes.Paste
.Left = 100
.top = 300
.width=100
.height=125
end with

Set PPSlide = Nothing

Set PPPres = Nothing

End sub

Not applicable
Author

Hi,

Try addressing the objects by its names like CH23, CH24...

Sub ExportPPT
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
Set PPSlide = objPresentation.Slides.Add(1,11)

set up = ActiveDocument.GetApplication.GetUserPreferences
up.ChartUseCapNBorder = True
ActiveDocument.GetApplication.SetUserPreferences up


with objPresentation.Slides(1).Shapes(1)
.TextFrame.TextRange = "Supervisory Controls"


'.Left = 100
'.top = 100
'.width=75
'.height=25
end with
ActiveDocument.Sheets("SH05").Activate
ActiveDocument.GetSheetObject("CH23").CopyBitmapToClipboard

with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 125
.width=400
.height=150
end with
ActiveDocument.GetSheetObject("CH25").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 300
.width=100
.height=125
end with
ActiveDocument.GetSheetObject("CH26").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 300
.width=100
.height=125
end with

Set PPSlide = objPresentation.Slides.Add(2,11)
with objPresentation.Slides(2).Shapes(1)
.TextFrame.TextRange = "Resource Forecasting"
end with


ActiveDocument.ActivateSheetByID "SH04"
'ActiveDocument.Sheets("SH04").Activate
ActiveDocument.GetSheetObject("CH22").CopyBitmapToClipboard
objPresentation.Slides(2).select
with objPresentation.Slides(2).Shapes.Paste
.Left = 100
.top = 125
.width=400
.height=150
end with

ActiveDocument.GetSheetObject("CH28").CopyBitmapToClipboard

with objPresentation.Slides(2).Shapes.Paste
.Left = 100
.top = 300
.width=100
.height=125
end with

Set PPSlide = Nothing

Set PPPres = Nothing

End sub

knahavandi
Contributor
Contributor

Hi Erich, I tried your sample qvw and I am having the same issue as with my application..The images pasted in ppt are cropped. Do you have any idea how I can fix this?

knahavandi
Contributor
Contributor

Hi Erich, I tried your sample qvw and I am having the same issue as with my application..The images pasted in ppt are cropped. Do you have any idea how I can fix this?