A
andy
I would like a macro to insert a blank slide, insert and
position a text box, change font size, change to bold, and
center the text, leaving the text box in place (even if it
says "Type Here!"). I recorded the following macro,
however it produces the folowing error: Runtime error '-
2147188160 (80048240'): Shape (unknown member): Invalid
Request. To select a shape, its view must be active.
However if you are on slide #11 (Index:=11), as I was when
I recorded the macro (see the 2nd line of code below, the
1st line of code to begin with ActiveWindow...), the macro
will do exactly what I had intended it to do.
Instead of hard-coding the Index:=11, can powerpoint code
find the location of the slide which is currently active,
and execute the macro based on that location (insert after
the current slide). Perhaps if the current slide Index can
be determined, then that parameter can be substituted (in
the line below in the Index:= 11) and in that way the
macro would insert, etc. after the current position just
as I would like dynamically.
Thank you in advance
God bless you
Here is the code:
Sub NewSlideInsertTextBoxAndFormat()
ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=11,
Layout:=ppLayoutBlank).SlideIndex
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox
(msoTextOrientationHorizontal, 0#, 0#, 720#, 36#).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap =
msoTrue
ActiveWindow.Selection.TextRange.Font.Size = 54
ActiveWindow.Selection.TextRange.Font.Bold = msoTrue
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Parag
raphs(Start:=1, Length:=1).ParagraphFormat.Alignment =
ppAlignCenter
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Chara
cters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "Type Here!"
With .Font
.Name = "Times New Roman"
.Size = 54
.Bold = msoTrue
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With
End With
ActiveWindow.Selection.Unselect
End Sub
position a text box, change font size, change to bold, and
center the text, leaving the text box in place (even if it
says "Type Here!"). I recorded the following macro,
however it produces the folowing error: Runtime error '-
2147188160 (80048240'): Shape (unknown member): Invalid
Request. To select a shape, its view must be active.
However if you are on slide #11 (Index:=11), as I was when
I recorded the macro (see the 2nd line of code below, the
1st line of code to begin with ActiveWindow...), the macro
will do exactly what I had intended it to do.
Instead of hard-coding the Index:=11, can powerpoint code
find the location of the slide which is currently active,
and execute the macro based on that location (insert after
the current slide). Perhaps if the current slide Index can
be determined, then that parameter can be substituted (in
the line below in the Index:= 11) and in that way the
macro would insert, etc. after the current position just
as I would like dynamically.
Thank you in advance
God bless you
Here is the code:
Sub NewSlideInsertTextBoxAndFormat()
ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=11,
Layout:=ppLayoutBlank).SlideIndex
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox
(msoTextOrientationHorizontal, 0#, 0#, 720#, 36#).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap =
msoTrue
ActiveWindow.Selection.TextRange.Font.Size = 54
ActiveWindow.Selection.TextRange.Font.Bold = msoTrue
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Parag
raphs(Start:=1, Length:=1).ParagraphFormat.Alignment =
ppAlignCenter
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Chara
cters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "Type Here!"
With .Font
.Name = "Times New Roman"
.Size = 54
.Bold = msoTrue
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With
End With
ActiveWindow.Selection.Unselect
End Sub