Results 1 to 2 of 2
  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Active slide font color (2003 SP2)

    <P ID="edit" class=small>(Edited by JohnBF on 11-Oct-07 08:25. )</P>Following from <!post=this post,670,122>this post<!/post> and it's predecessor, there is one more thing I can't figure out. My objective is to convert the pasted Excel table to the target Slide default font color, whatever it may be, but I haven't been able to find exactly where that is. At this point (edited code), I'm at:

    Dim rgbFontColor As RGBColor

    With ActiveWindow.View.Slide
    rgbFontColor = .ColorScheme.Colors(ppForeground)
    With .Shapes.PasteSpecial(DataType:=ppPasteHTML)
    If .HasTable Then
    .TextEffect.Font.Color.SchemeColor = rgbFontColor

    How can I get what I'm looking for?

    Edit: I'm also looking for table border to inherit the default Slide border color. So in other words, If I paste an Excel table which uses black font and black borders, and the Slide text and border default colors are white, how do I make them change?
    -John ... I float in liquid gardens
    UTC -7ąDS

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Active slide font color (2003 SP2)

    Here is some sample code.
    I have no idea about the relationship between the scheme color constants such as ppForeColor and their actual use, so I used two arbitrary ones.
    I can't make it work using the shp object itself, I was forced to select it. Someone better versed in PowerPoint VBA may know how it should be done.
    If your table has many cells, the code is excruciatingly slow.

    Sub Test()
    Dim sld As Slide
    Dim shp As ShapeRange
    Dim lngRGB1 As Long
    Dim lngRGB2 As Long
    Dim tbl As Table
    Dim i As Integer
    Dim j As Integer
    Dim k As PpBorderType

    lngRGB1 = sld.ColorScheme(ppForeground).RGB
    lngRGB1 = sld.ColorScheme(ppBackground).RGB

    Set sld = ActiveWindow.View.Slide
    Set shp = sld.Shapes.PasteSpecial(ppPasteHTML)
    shp.Select

    With ActiveWindow.Selection.ShapeRange
    If .HasTable Then
    Set tbl = .Table
    For i = 1 To tbl.Rows.Count
    For j = 1 To tbl.Columns.Count
    tbl.Cell(i, j).Shape.TextFrame.TextRange.Font.Color.RGB = lngRGB1
    For k = ppBorderTop To ppBorderRight
    With tbl.Cell(i, j).Borders(k)
    .Visible = True
    .ForeColor.RGB = lngRGB2
    End With
    Next k
    Next j
    Next i
    End If
    End With
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •