Add right justfied tab to a textframe via VBA (Office 2007)

D

Dale Fye

I'm using Access to build a series of data driven slides, mostly textframes
with special formatting. With help from a variety of individuals in the
PowerPoint community, I'm almost done. However, one of my text frames will
include some text, followed by a date on each row. What I would like to do,
is be able to embedd tabs in the text string that I am passing to a function.
The function creates the textframe and does the formatting.

So, how do I add a right justified tab formatting to the text frame, so that
the tabs that are embedded in the text between the events and the dates will
result in a left justified event names and right justified event dates.

One additional question. Is there any way (other than creating a table) to
change the background color of every other row of text in the same text
frame? I know I could build multiple textframes that only handle a single
row each, but I'm just wondering
 
D

Dale Fye

Thanks, Steve!

Steve Rindsberg said:
Sub StopThatTab()
Dim oSh As Shape
Dim x As Long

' for demo purposes, we'll use the currently selected
' shape. so be sure to select one. ;-)
Set oSh = ActiveWindow.Selection.ShapeRange(1)

With oSh.TextFrame.Ruler
' Delete any existing tabstops
For x = .TabStops.Count To 1 Step -1
.TabStops(x).Clear
Next

' Now add right tabs at 1, 2 and 4 inches
' Measurements are in points, 72 to the inch
.TabStops.Add ppTabStopRight, 72
.TabStops.Add ppTabStopRight, 144
.TabStops.Add ppTabStopRight, 288
End With
End Sub



You could add rectangles behind every other row of text.

You'd work with the textrange's .Lines or .Paragraphs object, whichever is
more
appropriate.

This is nowhere close but it'll get you started. It puts a rectangle
around
each line of text. You'll need to use z-order to send the rectangles
behind the
text and will probably want to adjust the numbers a bit to account for
line
spacing.

Sub Thing()
Dim oSh As Shape
Dim x As Long
Dim oSl As Slide

Set oSh = ActiveWindow.Selection.ShapeRange(1)
Set oSl = ActivePresentation.Slides(1)

With oSh.TextFrame.TextRange
For x = 1 To .Lines.Count
oSl.Shapes.AddShape msoShapeRectangle, _
oSh.Left, .Lines(x).BoundTop, oSh.Width, .Lines(x).BoundHeight
Next
End With
End Sub



==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top