Prev: Why is Close Group option greyed out?
Next: IE8 converts ppsx and pptx files to zip files FF does not
From: Clifton Ivey on 19 Dec 2009 08:03 Here is a link to an article on MSDN that leads me to believe I can do this: http://msdn.microsoft.com/en-us/library/bb265915.aspx "Clifton Ivey" wrote: > Thanks Steve. I am afraid you are correct and there is no simple way to do > what I want, but I had been led to believe from researching this that it may > be possible to interact with the cells in a table as a ShapeRange. I even > found a couple of examples, but couldn't get them to work. > > The code I've tried looks like this: > > With oSlide.Shapes.Range("myTablesName") > With .Fill > .Visible=True > .BackColor.SchemeColor = ppShadow > End With > With .TextFrame.TextRange.Font > .Italic = msoTrue > .Color.RGB = RGB(125, 0, 125) > End With > End With > > ======== end code ============ > > From what I've read I thought the cells are shapes embedded in the table > which is also a shape. So why can't I get a handle on it as a Range? > > Thanks again, > Brian > > "Steve Rindsberg" wrote: > > > In article <D9EA683C-6021-433D-9C87-5944B0DD9524(a)microsoft.com>, Clifton Ivey > > wrote: > > > Is there any way to modify them as a group? As opposed to modifying each > > > individual cell. > > > > If you find a way, I'd love to hear of it. > > Somebody please! Expose my ignorance. ;-) > > > > Cell by cell is the only way I'm aware of. > > And man, is it ever SLOW. > > > > One trick though: add as few rows/columns as you can to start, format them, > > then add rows and colums as needed. MUCH faster than adding them first then > > formatting. > > > > > > > > "Steve Rindsberg" wrote: > > > > > > > On Sun, 13 Dec 2009 21:01:01 -0500, Clifton Ivey <clifton ivey > > > > <"africom.mil>"> wrote: > > > > > > > > > I have a table I added via VBA like this: > > > > > > > > > > set oTable = ActivePresentation.Slides("mySlide").Shapes.AddTable(...) > > > > > > > > > > I then add some cells to it by: > > > > > > > > > > oTable.Cell(...).Shape.TextFrame.TextRange.Text = "some text" > > > > > > > > > > However, I cannot get a handle on these cells to update the font, fill, > > > > > etc. > > > > > > > > > > What is the best way to do this? > > > > > > > > oTable.Cell(x,y).Shape gives you a reference to the shape that represents > > > > the cell. > > > > You can format it using the same properties as you would any other shape. > > > > > > > > > > > > > > > > > > > > -- > > > > ================================ > > > > Steve Rindsberg > > > > PPTools add-ins for PowerPoint > > > > http://www.pptools.com > > > > The PowerPoint FAQ > > > > http://www.pptfaq.com > > > > . > > > > > > > > > > ============================== > > PPT Frequently Asked Questions > > http://www.pptfaq.com/ > > > > PPTools add-ins for PowerPoint > > http://www.pptools.com/ > > > > > > . > >
From: Steve Rindsberg on 19 Dec 2009 13:31 In article <D6C75F02-F0F1-43D2-AC1B-219D2D2B9802(a)microsoft.com>, Clifton Ivey wrote: > Thanks Steve. I am afraid you are correct and there is no simple way to do > what I want, but I had been led to believe from researching this that it may > be possible to interact with the cells in a table as a ShapeRange. I even > found a couple of examples, but couldn't get them to work. > > The code I've tried looks like this: > > With oSlide.Shapes.Range("myTablesName") > With .Fill > .Visible=True > .BackColor.SchemeColor = ppShadow > End With > With .TextFrame.TextRange.Font > .Italic = msoTrue > .Color.RGB = RGB(125, 0, 125) > End With > End With Problem is, that simply creates a range of one shape, the table itself. It doesn't do anything that you couldn't do via oSlide.Shapes("myTablesName") And that gives you a reference to the shape, not the table object within it or any of the cell(x,y).shape objects within the table. You can construct a range of the individual shapes within the table, though. Dim oRng as ShapeRange ' assuming a slide 2 with a table in it that includes shapes named as follows ... Set oRng = ActivePresentation.Slides(2).Shapes.Range(Array(_ "rectangle 10", _ "rectangle 14")) oRng.Fill.Visible = True oRng.Fill.ForeColor.RGB = RGB(200, 0, 0) And IIRC, there's a trick to building the array parameter as a string of names, but I can't quite remember it at the moment. Ah, but the computer remembers for me, all hail the computer: Dim oRng As ShapeRange Dim oSh As Shape Dim sNames As String Dim aTemp() As Variant Dim x As Long Dim y As Long Dim lIndex As Long Set oSh = ActivePresentation.Slides(2).Shapes(1) ReDim aTemp(1 To 6) ' number of cells we're after lIndex = 1 With oSh.Table For x = 2 To 3 For y = 1 To 3 aTemp(lIndex) = .Cell(x, y).Shape.Name lIndex = lIndex + 1 Next Next End With Set oRng = ActivePresentation.Slides(2).Shapes.Range(aTemp) oRng.Fill.Visible = True oRng.Fill.ForeColor.RGB = RGB(200, 0, 0) > > ======== end code ============ > > From what I've read I thought the cells are shapes embedded in the table > which is also a shape. So why can't I get a handle on it as a Range? > > Thanks again, > Brian > > "Steve Rindsberg" wrote: > > > In article <D9EA683C-6021-433D-9C87-5944B0DD9524(a)microsoft.com>, Clifton Ivey > > wrote: > > > Is there any way to modify them as a group? As opposed to modifying each > > > individual cell. > > > > If you find a way, I'd love to hear of it. > > Somebody please! Expose my ignorance. ;-) > > > > Cell by cell is the only way I'm aware of. > > And man, is it ever SLOW. > > > > One trick though: add as few rows/columns as you can to start, format them, > > then add rows and colums as needed. MUCH faster than adding them first then > > formatting. > > > > > > > > "Steve Rindsberg" wrote: > > > > > > > On Sun, 13 Dec 2009 21:01:01 -0500, Clifton Ivey <clifton ivey > > > > <"africom.mil>"> wrote: > > > > > > > > > I have a table I added via VBA like this: > > > > > > > > > > set oTable = ActivePresentation.Slides("mySlide").Shapes.AddTable(...) > > > > > > > > > > I then add some cells to it by: > > > > > > > > > > oTable.Cell(...).Shape.TextFrame.TextRange.Text = "some text" > > > > > > > > > > However, I cannot get a handle on these cells to update the font, fill, > > > > > etc. > > > > > > > > > > What is the best way to do this? > > > > > > > > oTable.Cell(x,y).Shape gives you a reference to the shape that represents > > > > the cell. > > > > You can format it using the same properties as you would any other shape. > > > > > > > > > > > > > > > > > > > > -- > > > > ================================ > > > > Steve Rindsberg > > > > PPTools add-ins for PowerPoint > > > > http://www.pptools.com > > > > The PowerPoint FAQ > > > > http://www.pptfaq.com > > > > . > > > > > > > > > > ============================== > > PPT Frequently Asked Questions > > http://www.pptfaq.com/ > > > > PPTools add-ins for PowerPoint > > http://www.pptools.com/ > > > > > > . > > ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
First
|
Prev
|
Pages: 1 2 Prev: Why is Close Group option greyed out? Next: IE8 converts ppsx and pptx files to zip files FF does not |