Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select a particular slide in powerpoint (export via macro)

Hello,

I am trying to export existing graph on a powerpoint slide to update it. Basically, it means that I need to SELECT a already existing slide in the PPT; Unfortunatly, I cannot find the way to so, as all script/example I am refering to are dealing with:

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

Where I'd rather have to use sthg like:

' found in Slide.Select Method (PowerPoint)

Set PPSlide = PPPres.Slides(4).Select 'to go to Slide nb4

Do you see a a way to do so ?

Thanks for your help!

Here is the function I am using:

FUNCTION ajout_slide(PPApp,SheetID,ObjectID,SlideNB,marginX,marginY,sizeX,sizeY,ppt_doc,qvw_file)

  ActiveDocument.ActivateSheet SheetID

  ActiveDocument.GetAPplication.WaitForIdle

  ActiveDocument.GetSheetObject(ObjectID).CopyBitmapToClipboard

'msgbox("Copy:"&vbcrlf&"SheetID: "&SheetID&vbcrlf&"Object: "&ObjectID&vbcrlf&"Slide: "&SlideNB&vbcrlf&"MarginX: "&marginX&vbcrlf&"MarginY: "&marginY&vbcrlf&"sizeX: "&sizeX&vbcrlf&"sizeY: "&sizeY&vbcrlf&"PPT file: "&ppt_doc&vbcrlf&"Qlikview file: "&qvw_file)

'exit function

  Set PPApp = CreateObject("Powerpoint.Application")

  PPApp.Visible = True

  vPPTTemplatePath = ppt_doc

  Set PPPres = PPApp.Presentations.Open(vPPTTemplatePath, 0) ' -1 = read only

   ' ------------------------------------------------------------------------------------------------------

   ' Should select HERE slide nb <SlideNB> instead of creating one!

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

   ' ------------------------------------------------------------------------------------------------------

  PPSlide.Shapes.Paste

  if(marginX<>0) then PPSlide.Shapes(PPSlide.Shapes.Count).Left = marginX

  if(marginY<>0) then PPSlide.Shapes(PPSlide.Shapes.Count).Top = marginY

  if(sizeX<>0) then PPSlide.Shapes(PPSlide.Shapes.Count).Width = sizeX end if

  if(sizeY<>0) then PPSlide.Shapes(PPSlide.Shapes.Count).Height = sizeY end if

  PPSlide.Shapes(PPSlide.Shapes.Count).PictureFormat.TransparentBackground = msoTrue

  PPSlide.Shapes(PPSlide.Shapes.Count).PictureFormat.TransparencyColor = RGB(255, 255, 255)

  PPSlide.Shapes(PPSlide.Shapes.Count).Fill.Visible = msoFalse

  PPPres.SaveAs ppt_doc

  PPPres.Close

  PPApp.Quit

  

  Set PPSlide = Nothing

  Set PPPres = Nothing

  Set PPApp = Nothing

  'PPApp.Visible = False

END FUNCTION

1 Reply
Not applicable
Author

hello,

Nobody has a clue ?