makako
04-02-2008, 08:10 AM
Hi, i have always worked VBA in excel only. Today I was trying to create a series of slides in ppt and to variate a single textbox. My Idea was using a database in excel filled with names. The macro was supposed to copy the initial slide and modify-insert a textbox with each name in my data. I started recording the macro in PPT and this is what I got
ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "My Name"
With .Font
.Name = "Arial"
.Size = 44
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppTitle
End With
End With
ActiveWindow.Selection.Unselect
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutText).SlideIndex
but as I tried to create a variable "myVar as Range" Range was not an option. Is there a way to relate VBA code avaliable in Excel in ppt? thanks
ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "My Name"
With .Font
.Name = "Arial"
.Size = 44
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppTitle
End With
End With
ActiveWindow.Selection.Unselect
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutText).SlideIndex
but as I tried to create a variable "myVar as Range" Range was not an option. Is there a way to relate VBA code avaliable in Excel in ppt? thanks