Sub indent()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide
Set PPSlide =
PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
PPPres.Slides(1).Shapes("Table").Table.Cell(2,
1).Shape.TextFrame.TextRange.Paragraphs(3).Select
With PPPres.Slides(1).Shapes("Table").Table.Cell(2,
1).Shape.TextFrame.TextRange
.Paragraphs(3).IndentLevel = 2
End With
End Sub
In the table, I have 5 bullet items like this:
1. aaaaa
2. bbbbb
3. ccccc
4. ddddd
5. eeeee
After running the above routine, I get the following:
1. aaaaa
2. bbbbb
1. ccccc
3. ddddd
4. eeeee
So I know it is properly selecting the paragraph since the 3rd indent bullet
is now at "1" and the other bullets after the 3 bullet are reordered. What I
would expect to see if the indentlevel property was working correctly is the
following in the table cell:
1. aaaaa
2. bbbbb
1. ccccc
3. ddddd
4. eeeee
Suggestions?
The amount of indent for the various indent levels is governed by the
FirstLineIndent and .LeftIndent settings of the paragraph.
These used to be properties of the .Ruler object of the TextFrame, but now that
each paragraph can have its own tabs and indents, they're exposed through the
ParagraphFormat object. See mods to your code below:
> Sub indent()
> Dim PPApp As PowerPoint.Application
> Dim PPPres As PowerPoint.Presentation
> Dim PPSlide As PowerPoint.Slide
>
> Set PPApp = GetObject(, "Powerpoint.Application")
> Set PPPres = PPApp.ActivePresentation
> PPApp.ActiveWindow.ViewType = ppViewSlide
> Set PPSlide =
> PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
>
You don't really need this at all ... unless you specifically WANT to watch PPT
select the object (which slows down your code tremendously)
> PPPres.Slides(1).Shapes("Table").Table.Cell(2,
> 1).Shape.TextFrame.TextRange.Paragraphs(3).Select
And instead of this:
> With PPPres.Slides(1).Shapes("Table").Table.Cell(2,
> 1).Shape.TextFrame.TextRange
> .Paragraphs(3).IndentLevel = 2
> End With
Do:
With PPPres.Slides(1).Shapes("Table").Table.Cell(2,
1).Shape.TextFrame.TextRange.Paragraphs(3)
with .ParagraphFormat
.FirstLineIndent = 20
.LeftIndent = 10
end with
"Steve Rindsberg" wrote:
> In article <4837F87B-25BD-46C0...@microsoft.com>, Jimbo1004
> wrote:
> > I am not able to actually indent bullets as paragraphs when using VBA in
> > PowerPoint 2007. I am able to select any or all of the paragraphs (bullet
> > list), but when I try to increase the indentlevel from 1 to 2, the bullet
> > number changes, but the actual text remains left justified and doesn't move.
>
> The amount of indent for the various indent levels is governed by the
> .FirstLineIndent and .LeftIndent settings of the paragraph.
> .
>
Post what you've got now and I'll give it a try here.
"Steve Rindsberg" wrote:
With PPPres.Slides(1).Shapes("Table").Table.Cell(2, 1).Shape.TextFrame.Ruler
.Levels(1).FirstMargin = 0
.Levels(1).LeftMargin = 40
.Levels(2).FirstMargin = 60
.Levels(2).LeftMargin = 100
.Levels(3).FirstMargin = 120
.Levels(3).LeftMargin = 160
.Levels(4).FirstMargin = 180
.Levels(4).LeftMargin = 220
.Levels(5).FirstMargin = 240
.Levels(5).LeftMargin = 280
End With
> .
>
Yes. Nasty, isn't it? In some cases, you can beat it into behaving rationally by
putting in dummy text, formatting it to taste, then deleting it. The formatting seems
to then "stick" when you add "real" text later.