This was the business case i had for the following.
Powerpoint was being used by company A to produce sales books from a set of templates they had.
These sales books contain slides which were both vertical and horizontal orientation This was acheived by a manual process of creating two presentations (one horizontal, one vertical) Printing them out , and then a member of staff sorting out the order. This also left two ppt files containg the information in no sensible order.
This was the solution i came up.
Firslty i created two powerpoint presenations containg the templates, One for horizontal , one for vertical templates
I then used a third presentation for my code, which looked something like this
CODE
'Global pp_Final As Presentation ' Presenation we are creating
Global pp_Tools As Presentation ' This Presentation Global pp_Vert As Presentation ' All Vertical Slides Global pp_Horiz As Presentation ' All Horizontal slides Global sld_cnt as integer 'slide counter
Global Const str_TempPath As String = "C:\sales_books\"
Sub CutdownExampleForFAQCreatingNewPresentation
'Reference the horizontal and vertical slides Set pp_Vert = Application.Presentations.Open(str_TempPath & "PackVertical.ppt", , msoFalse, msoFalse) Set pp_Horiz = Application.Presentations.Open(str_TempPath & "PackHoriz.ppt", , msoFalse, msoFalse)
Sld_Cnt = 1
'create a new presentation Set pp_Final = Application.Presentations.Add 'Page set up With pp_Final .PageSetup.SlideOrientation = msoOrientationMixed .PageSetup.SlideSize = ppSlideSizeA4Paper End With
'In my original code i used a series of Select cases to decide what 'was needed in the final tax pack and there was a lot more processing involved ' this is cut down so apologies for any errors but hopefully it will give you ' enough to see whats happening.
Now what the above has done, has created a new presenation with 3 slides in it, One Vertival ,One Horizontal and Another Vertical
If you look at the presentation as it, you will see everything in the default page layout. Which is no good to us
IF you look at the above code, i used a tag property called O which stores a value of V for vertical slide and H for horizontal slides.
To Print my slides out in the correct orientation i used the following code
CODE
Public Sub CutDownProcess()
Dim var As Slide Dim str_tpath As String Dim str_A As String
'change orientation on tag and print out
For Each var In pp_Final.Slides
select case var.tag("O")
case "V" pp_Final.PageSetup.SlideOrientation = msoOrientationVertical case "H" pp_Final.PageSetup.SlideOrientation = msoOrientationHorizontal
end select
pp_Final.PrintOut var.slideindex,var.slideindex
Next
End Sub
Presentation printed out correctly in order and stored in one place.
I did take this a stage further by at the same time of printing, creating a GIF of the slide using the export function and saving that down into a directory
Set oSlide = pp_Final.Slides(int_sld) With oSlide .Export ExportPath & "Slide" & CStr(.SlideIndex) & ".GIF", "GIF", Pixwidth, Pixheight End With
I then used a bit of javescript and html to enable someone to view that on screen in correct order ,
Another option is to put the slideorientation code above onto a button for next slide and , when someone plays the slide show you can flip the orientation.