Add bullets to textframe via Access vba (Office 2007)

D

Dale Fye

I'm using Access to generate a series of PPT slides.

On one of the slides, I have a bunch of individual lines that I am writing
to a text frame as a block (I create a string containing each of the lines
with a crlf following each line) when I pass this string to a function. As
part of each line, I have prefaced an extended ascii character to each line
that meets a certain set of data characteristics.

What I would like to do is:
1. count the number of lines that contain this character, then remove the
character(easy with the replace function).

2. turn on bullets for the first "n" lines (corresponds to those lines with
the prefixed character) of this text frame, and set the bullet to a red
checkmark. I'm sure this has something to do with the
"ParagraphFormat.Bullet" property, but would appreciate any code samples.

Thanks.
 
D

Dale Fye

OK, here is what I have so far.

intDirected = Len(LearningDemands) - Len(Replace(LearningDemands,
Chr$(251), ""))
LearningDemands = Replace(LearningDemands, Chr$(251), "")
oShape.TextFrame.TextRange = LearningDemands

For intLoop = 1 To intDirected
With oShape.TextFrame.TextRange.Lines(intLoop).ParagraphFormat.Bullet
.Type = ppBulletUnnumbered
.Visible = True
.RelativeSize = 1
.Font.Color = RGB(255, 0, 0)
End With
Next

This seems to work with a dot as the bullet.

Still need to figure out what the unicode value is for a checkmark.

Also, if one of the lines of text wraps around within the frame, the line
reference appears to count the wrapped text as another line, although it
doesn't put the bullet on that line. So, I'm wondering whether there is a
way to check to see whether the first character in a line is the chr$(251)
character, and if so, how do I delete the first character and then set the
bullet characteristics?
 
D

Dale Fye

Ok, based on my original response (to myself), I tried the following:

For intLoop = 1 To oShape.TextFrame.TextRange.Lines.Count
With oShape.TextFrame.TextRange.Lines(intLoop)
If Left(.Text, 1) = Chr$(251) Then
.Text = Mid(.Text, 2)
With .ParagraphFormat.Bullet
.Type = ppBulletUnnumbered
.Visible = True
.RelativeSize = 1
.Font.Color = RGB(255, 0, 0)
End With
End If
End With
Next

The problem with this code is that the following line:

.Text = Mid(.Text, 2)

seems to insert a hard carraige return at the end of those lines which do
not wrap within the text frame.
 
D

Dale Fye

After messing around with this for quite a while, this was what I came up with.

intDirected = Len(myString) - Len(Replace(myString, Chr$(251), ""))
myString = Replace(myString, Chr$(251), "")
oShape.TextFrame.TextRange = myString
For intLoop = 1 To intDirected
With oShape.TextFrame.TextRange.Paragraphs(intLoop)
With .ParagraphFormat.Bullet
.Type = ppBulletUnnumbered
.Character = 10004
.Visible = True
.RelativeSize = 1.5
.Font.Color = RGB(0, 128, 0)
End With
End With
Next
 
D

Dale Fye

Thanks for the help Steve.

Dale

Steve Rindsberg said:
Yep; .Lines really does mean lines. ;-)

Use the .Paragraphs collection instead of the .Lines collection.


Try adding this to the bullet formatting code:

.Font.Name = "Arial Unicode MS"
.Character = 9745

(9745 is decimal for the hex value CharMap provides for the character)





==============================
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