Param cTitleText,cPictureFile #DEFINE ppLayoutTitleOnly 11 #DEFINE msoFalse 0 #DEFINE msoTrue -1 #DEFINE ppForeground 2 Local oPicture, oPres, oView,nSlides,oCurSLide,nTitleTextLen,nFontSize Local SlideWidth,SlideHeight,nImgMaxHeight,nImgMaxWidth,nImgTop,nImgLeft,WtoH if type("G_oppt")<>"O" or IsNull(G_oPPT) Public G_Oppt G_oppt = CreateObject("Powerpoint.Application") if type("G_oppt")<>"O" or IsNull(G_oPPT) Messagebox("Error connecting to PowerPoint!",48,"Powerpoint automator") return endif endif with G_oPPT if .Visible <> msoTrue .Visible=msoTrue .WindowState=1 && Normal window endif if .presentations.count = 0 .presentations.add() endif if .activewindow.viewtype <> 1 .activewindow.viewtype = 1 endif EndWith With G_oPPT oPres=G_oPPT.ActivePresentation oView=G_oPPT.ActiveWindow.View Endwith With oPres.PageSetup SlideWidth=.SlideWidth SlideHeight=.SlideHeight endwith With oPres nSlides=.slides.Count+1 .slides.Add( nSlides, ppLayoutTitleOnly) oView.GotoSlide(nSlides) oCurSLide=oView.slide with oCurSLide.shapes .title.textframe.textrange.text=cTitleText nTitleTextLen=Len(cTitleText) nFontSize=18 Do Case Case Between(nTitleTextLen,40,60) nFontSize=24 Case Between(nTitleTextLen,20,40) nFontSize=28 Case nTitleTextLen < 20 nFontSize=30 EndCase with .title .textframe.textrange.font.size=nFontSize .textframe.textrange.font.Color.RGB = RGB(255, 255, 0) .top=-10 .height=.height-15 .left=5 .width=SlideWidth-10 endwith endwith With G_Oppt.ActiveWindow.Selection.SlideRange .FollowMasterBackground = msoFalse .DisplayMasterShapes = msoTrue With .Background .Fill.Visible = msoTrue .Fill.ForeColor.RGB = RGB(0, 0, 0) .Fill.Transparency = 0 .Fill.Solid() Endwith Endwith Endwith oPicture = oCurSLide.Shapes.AddPicture(cPictureFile, ; msoFalse, msoTrue, 1, 1, 1, 1) With oPicture .Visible=msoFalse .ScaleHeight( 1, msoTrue) .ScaleWidth( 1, msoTrue) EndWith * These can be tweaked to adjust real estate occupied by the image nImgMaxHeight=SlideHeight-100 nImgMaxWidth=SlideWidth-100 nImgTop=50 nImgLeft=50 with oPicture WtoH = (1.0000 * .Width) / (1.0000 * .Height) nFullWidth=SlideWidth- (nImgLeft * 2) if .Width > .Height .and. nFullWidth / WtoH < nImgMaxHeight .Left=nImgLeft .Width=nFullWidth .Top=(SlideHeight - (nFullWidth / WtoH) ) /2 + nImgTop/2 Else .Top=nImgTop + 10 .Height=nImgMaxHeight .Left = (SlideWidth - (WtoH * nImgMaxHeight)) / 2.0 endif .Visible=msoTrue Endwith Return