Cut and Paste Wide Spreadsheet in Powerpoint, spreadsheet gets cut off

P

Paul DeSaro

I have a wide spreadsheet that I need to paste into powerpoint from
excel. I have read about the limitations but thought this was fixed
in Office 2002. Below is my code any help would be greatly
appreciated.

'Launch Powerpoint
Set ppt = CreateObject("PowerPoint.Application")
'Make visible
ppt.Visible = msoTrue
'Insert New Presentation
Set pst = ppt.Presentations.Add
Set ppApp = GetObject(, "Powerpoint.Application.10")

' Reference active presentation
Set PPPres = ppApp.ActivePresentation

ppApp.ActiveWindow.ViewType = ppViewSlide

'-- some processing
Worksheets(ws.Name).Range(strRange).CopyPicture
Appearance:=xlScreen, _
Format:=xlBitmap

ppApp.ActivePresentation.Slides(iSlides).Shapes.Paste

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Top = 10
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Left = 10

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleWidth
dScale, True
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleHeight
dScale, True

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Align
msoAlignCenters, _
True
 
G

Guest

Hi Paul

Try function like this below . .

I am using a error handler coz sometimes it gives error on copypicture method and sometimes it works fine
so i am using resume to make it work

Sub PresentationExample(ByVal PPApp As PowerPoint.Application, ByVal PPPres As PowerPoint.Presentation, ByVal prmRange As Excel.Range
on error goto errhandle
Dim PPSlide As PowerPoint.Slid
Dim objRange As Excel.Rang
Set objRange = prmRang
Set PPSlide = PPPres.Slides.Add(PPPres.Slides.Count + 1, ppLayoutBlank
objRange.Selec
Application.CutCopyMode = False

objRange.CopyPicture Appearance:=xlScreen,
Format:=xlPictur

PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideInde
PPSlide.Shapes.PasteSpecial.Selec
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).LockAspectRatio = msoTru
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleHeight(1, msoFalse, msoScaleFromTopLeft
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleWidth(1, msoFalse, msoScaleFromTopLeft
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Width = 647.4
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Top =
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Left =
PPPres.Slides(PPSlide.SlideIndex).Shapes.Range.Align msoAlignCenters, Tru
PPPres.Slides(PPSlide.SlideIndex).Shapes.Range.Align msoAlignMiddles, Tru
Application.CutCopyMode = Fals
Set objRange = Nothin
errhandler:
Application.CutCopyMode = Fals
resum
End Su


Thanks
Kama

I have a wide spreadsheet that I need to paste into powerpoint fro
excel. I have read about the limitations but thought this was fixe
in Office 2002. Below is my code any help would be greatl
appreciated

'Launch Powerpoin
Set ppt = CreateObject("PowerPoint.Application"
'Make visibl
ppt.Visible = msoTru
'Insert New Presentatio
Set pst = ppt.Presentations.Ad
Set ppApp = GetObject(, "Powerpoint.Application.10"

' Reference active presentatio
Set PPPres = ppApp.ActivePresentatio

ppApp.ActiveWindow.ViewType = ppViewSlid

'-- some processing
Worksheets(ws.Name).Range(strRange).CopyPictur
Appearance:=xlScreen,
Format:=xlBitma

ppApp.ActivePresentation.Slides(iSlides).Shapes.Past

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Top = 1
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Left = 1

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleWidt
dScale, Tru
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleHeigh
dScale, Tru

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Alig
msoAlignCenters,
Tru
 
G

Guest

Hi Paul

Sometimes CopyPicture gives error and sometimes it works fine inspite of usin
Application.CutCopyMode = False which theratically clears the clipboard contents.so i have used resume
hope it helps
Take a look at the below func
Sub PasteRangeToPPT(ByVal PPApp As PowerPoint.Application, ByVal PPPres As PowerPoint.Presentation, ByVal prmRange As Excel.Range
On Error GoTo errhandle
Dim PPSlide As PowerPoint.Slid
Dim objRange As Excel.Rang
Set objRange = prmRang
Set PPSlide = PPPres.Slides.Add(PPPres.Slides.Count + 1, ppLayoutBlank
objRange.Selec
Application.CutCopyMode = Fals

objRange.CopyPicture Appearance:=xlScreen,
Format:=xlPictur


PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideInde

PPSlide.Shapes.PasteSpecial.Selec
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).LockAspectRatio = msoTru
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleHeight(1, msoFalse, msoScaleFromTopLeft
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleWidth(1, msoFalse, msoScaleFromTopLeft
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Width = 647.4
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Top =
PPPres.Slides(PPSlide.SlideIndex).Shapes(1).Left =
PPPres.Slides(PPSlide.SlideIndex).Shapes.Range.Align msoAlignCenters, Tru
PPPres.Slides(PPSlide.SlideIndex).Shapes.Range.Align msoAlignMiddles, Tru
Application.CutCopyMode = Fals
Set objRange = Nothin
Exit Su
errhandler
Application.CutCopyMode = Fals
Resum
End Su

Thanks
Kama
----- Paul DeSaro wrote: ----

I have a wide spreadsheet that I need to paste into powerpoint fro
excel. I have read about the limitations but thought this was fixe
in Office 2002. Below is my code any help would be greatl
appreciated

'Launch Powerpoin
Set ppt = CreateObject("PowerPoint.Application"
'Make visibl
ppt.Visible = msoTru
'Insert New Presentatio
Set pst = ppt.Presentations.Ad
Set ppApp = GetObject(, "Powerpoint.Application.10"

' Reference active presentatio
Set PPPres = ppApp.ActivePresentatio

ppApp.ActiveWindow.ViewType = ppViewSlid

'-- some processing
Worksheets(ws.Name).Range(strRange).CopyPictur
Appearance:=xlScreen,
Format:=xlBitma

ppApp.ActivePresentation.Slides(iSlides).Shapes.Past

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Top = 1
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Left = 1

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleWidt
dScale, Tru
ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.ScaleHeigh
dScale, Tru

ppApp.ActivePresentation.Slides(iSlides).Shapes.Range.Alig
msoAlignCenters,
Tru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top