VBA CODE FOR FORMATTING TEXT WHICH IS TEXT PLACEHOLDER IN TITLE AND CONTENT LAYOUT IN POWER POINT

Dear Team,

I have the below vba code to insert bullets with customize formats and alignment. Now I am looking forward to the incorporate the following below mentioned actions  in the code .

Please note that slide contains 2 text placeholder one for the Title and other for text


1. Reposition my text placeholder having (Top=75, Left=90,Width=739 and Height may vary depending on text.To have more clarity for the position of text placeholder I have appended below the image of shape dimensions from Microsoft power point 2016.


2. the text inside the placeholder should be calibri , size 12 & color (R=89,G=89,B=89)

For the size and margins to be freezed I am attaching an image for better clarity.



I need to collate this action with the below mentioned codes to have alignment of text and bullets


Sub Mybullets()

Dim pghcnt As Integer

With ActiveWindow.Selection.TextRange

.ParagraphFormat.bullet.Font.Name = "Wingdings"

.ParagraphFormat.bullet.Character = 167

.ParagraphFormat.Alignment = ppAlignJustify

.ParagraphFormat.bullet.Font.Color = RGB(89, 89, 89)

.ParagraphFormat.bullet.RelativeSize = 0.75


End With

For pghcnt = 1 To Windows(1).Selection.TextRange.Paragraphs.Count

Windows(1).Selection.TextRange.Paragraphs(pghcnt).IndentLevel = 1

With Windows(1).Selection.ShapeRange.TextFrame.Ruler

.Levels(1).FirstMargin = 7

.Levels(1).LeftMargin = 20

End With

Next

End Sub

Open in new window

Further the layout contains title and content placeholder.

Please help me to collate the text part as well.

Thanks in advance

Regards
Dilpreet Singh
content.PNG
Dilpreet SinghPROGRAMMERAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John WilsonCEO PowerPoint AlchemyCommented:
First you need to say which version of Office. The code you have used to set the indents is legacy code from 2003 if you have a later version you should really use the new code for textframe2.

Using legacy code try this

Sub Set_Bullet_Position()
Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
Set osld = ActiveWindow.Selection.SlideRange(1)
If Not osld Is Nothing Then
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then

If oshp.PlaceholderFormat.Type = ppPlaceholderObject Then
oshp.Left = 90
oshp.Top = 75
oshp.Width = 739
oshp.TextFrame.TextRange.Font.Color.RGB = RGB(89, 89, 89)
oshp.TextFrame.TextRange.IndentLevel = 1
With oshp.TextFrame.TextRange
.Font.Color.RGB = RGB(89, 89, 89)
.Font.Name = "Calibri"
.Font.Size = 12
.IndentLevel = 1
With .ParagraphFormat
.Bullet.Font.Name = "Wingdings"
.Bullet.Character = 167
.Alignment = ppAlignJustify
.Bullet.Font.Color = RGB(89, 89, 89)
.Bullet.RelativeSize = 0.75
End With
End With
With oshp.TextFrame.Ruler
.Levels(1).FirstMargin = 7
.Levels(1).LeftMargin = 20
End With
End If
End If
Next oshp
Else
MsgBox "Select a slide"
Err.Clear
End If
End Sub

Open in new window

Dilpreet SinghPROGRAMMERAuthor Commented:
Dear Team,

After selecting the text placeholder, The code is not at all working and I am currently working with Microsoft office professional plus 2016..

Please suggest .

Regards
John WilsonCEO PowerPoint AlchemyCommented:
Do you mean that the slide has Title / Content AND two text Placeholders or something else. Posting a slide somewhere would help.
John WilsonCEO PowerPoint AlchemyCommented:
If you are selecting the shape (ot text) then try

Sub Set_Bullet_Position()
Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Not oshp Is Nothing Then
With oshp
oshp.Left = 90
oshp.Top = 75
oshp.Width = 739
With oshp.TextFrame.TextRange
oshp.TextFrame.TextRange.IndentLevel = 1
.Font.Color.RGB = RGB(89, 89, 89)
.Font.Name = "Calibri"
.Font.Size = 12
.IndentLevel = 1
With .ParagraphFormat
.Bullet.Font.Name = "Wingdings"
.Bullet.Character = 167
.Alignment = ppAlignJustify
.Bullet.Font.Color = RGB(89, 89, 89)
.Bullet.RelativeSize = 0.75
End With
End With
With oshp.TextFrame.Ruler
.Levels(1).FirstMargin = 7
.Levels(1).LeftMargin = 20
End With
End With
Else
MsgBox "Nothing appropriate selected"
Err.Clear
End If
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dilpreet SinghPROGRAMMERAuthor Commented:
Thanks for your code sir, I was indeed helpful.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.