View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kamal[_5_] Kamal[_5_] is offline
external usenet poster
 
Posts: 4
Default Cut and Paste Wide Spreadsheet in Powerpoint, spreadsheet gets cut off

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).LockAs pectRatio = msoTru
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleH eight(1, msoFalse, msoScaleFromTopLeft
Call PPPres.Slides(PPSlide.SlideIndex).Shapes(1).ScaleW idth(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.Ali gn msoAlignCenters, Tru
PPPres.Slides(PPSlide.SlideIndex).Shapes.Range.Ali gn 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.Pa st

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

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

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