If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Alternate row highlighting in text frame (PPT 2007)
Working in a text frame, is there a way to highlight alternate rows to make
the data presented in the frame more legible? I know I could use a table and "banded rows", but am building this text frame via VBA, and would rather not have to deal with creating a table and inserting data one line at a time into the table. I also know I could play around with creating rectangles behind the textframe, but would rather not do that either. ---- Dale |
#2
|
|||
|
|||
Alternate row highlighting in text frame (PPT 2007)
I'm not suggesting this is necessarily workable but it may help!
I was surprized to find that this works in 2007: Dim otxR2 As TextRange2 'Shapes(3) is a textbox Set otxR2 = ActivePresentation.Slides(1).Shapes(3).TextFrame2. TextRange otxR2.Lines(1).Font.Highlight.RGB = vbYellow and more surprized to find I can't unhighlight! The only way to get back seems to be create a default textbox and use pickup / apply (or the format painter) If you find a way let me know! -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoi...tutorials.html "Dale Fye" wrote: Working in a text frame, is there a way to highlight alternate rows to make the data presented in the frame more legible? I know I could use a table and "banded rows", but am building this text frame via VBA, and would rather not have to deal with creating a table and inserting data one line at a time into the table. I also know I could play around with creating rectangles behind the textframe, but would rather not do that either. ---- Dale |
#3
|
|||
|
|||
Alternate row highlighting in text frame (PPT 2007)
John,
that is pretty cool, but unfortunately, it only highlights the text on those lines. It works well for one of the text frames I'm trying to highlight, which has full sentences, but for the frame contains text on one side, a tab character, and text all the way to the right, so I get white space between the text, rather than a fully highlighted line. I may have to go with building the rectangles and putting them in the background. Anybody got any example code for grouping multiple shapes and then pushing them to the back? ---- HTH Dale "John Wilson" wrote: I'm not suggesting this is necessarily workable but it may help! I was surprized to find that this works in 2007: Dim otxR2 As TextRange2 'Shapes(3) is a textbox Set otxR2 = ActivePresentation.Slides(1).Shapes(3).TextFrame2. TextRange otxR2.Lines(1).Font.Highlight.RGB = vbYellow and more surprized to find I can't unhighlight! The only way to get back seems to be create a default textbox and use pickup / apply (or the format painter) If you find a way let me know! -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoi...tutorials.html "Dale Fye" wrote: Working in a text frame, is there a way to highlight alternate rows to make the data presented in the frame more legible? I know I could use a table and "banded rows", but am building this text frame via VBA, and would rather not have to deal with creating a table and inserting data one line at a time into the table. I also know I could play around with creating rectangles behind the textframe, but would rather not do that either. ---- Dale |
#4
|
|||
|
|||
Alternate row highlighting in text frame (PPT 2007)
Ok, here is what I have so far. This works pretty well, except:
1. I still have not figured out how to group all of these shapes together and push them behind the textframe. 2. The spacing is just a little bit off. My guess is that I need to adjust: a. The initial Top setting. Right now it is lined up with the top of the frame, but there appears to be an offset between the top of the frame and the first line of text. b. The height slightly of the multi line paragraphs. I'm not sure what to look for here 3. Have not figured out how to turn off the borders (get rid of the lines around the rectangles). Public Sub HighlightTextFrame(oSlide as Powerpoint.Slide, _ oShape as Powerpoint.Shape) Dim intLoop As Integer Dim dblTop As Double, dblLeft As Double, dblWidth As Double Dim dblHeight As Double Dim oTxtRng As powerpoint.TextRange Set oTxtRng = oShape.TextFrame.TextRange dblTop = oShape.Top + 2 dblLeft = oShape.Left dblWidth = oShape.Width dblHeight = oShape.Height / oShape.TextFrame.TextRange.Lines.Count For intLoop = 1 To oTxtRng.Paragraphs.Count 'Add a rectangle Set oShape = oslide.Shapes.AddShape(1, dblLeft, dblTop, dblWidth, _ dblHeight * oTxtRng.Paragraphs(intLoop).Lines.Count) oShape.Fill.ForeColor.RGB = IIf(intLoop Mod 2 = 1, vbWhite, RGB(215, 215, 215)) dblTop = dblTop + (dblHeight * oTxtRng.Paragraphs(intLoop).Lines.Count) Next End Sub ---- Dale "John Wilson" wrote: I'm not suggesting this is necessarily workable but it may help! I was surprized to find that this works in 2007: Dim otxR2 As TextRange2 'Shapes(3) is a textbox Set otxR2 = ActivePresentation.Slides(1).Shapes(3).TextFrame2. TextRange otxR2.Lines(1).Font.Highlight.RGB = vbYellow and more surprized to find I can't unhighlight! The only way to get back seems to be create a default textbox and use pickup / apply (or the format painter) If you find a way let me know! -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoi...tutorials.html "Dale Fye" wrote: Working in a text frame, is there a way to highlight alternate rows to make the data presented in the frame more legible? I know I could use a table and "banded rows", but am building this text frame via VBA, and would rather not have to deal with creating a table and inserting data one line at a time into the table. I also know I could play around with creating rectangles behind the textframe, but would rather not do that either. ---- Dale |
Thread Tools | |
Display Modes | |
|
|