Consulting

Results 1 to 3 of 3

Thread: Making table fonts all black in below code

  1. #1
    VBAX Regular
    Joined
    Dec 2018
    Posts
    69
    Location

    Making table fonts all black in below code

    Hi John

    I have code below, and I've tried EVERYTHING for the past few hours so it changes any fonts to black. Sounds simple, but impossible!

    Working Code: (but doesn't change any fonts to black)

    Public Sub TableLines()


    Dim tbl As Table
    Dim iCol As Integer
    Dim iRow As Integer
    Dim I As Integer
    Set tbl = ActiveWindow.Selection.ShapeRange(1).Table
    ' hide selected borders
    Call CommandBars.ExecuteMso("BorderNone")
    DoEvents
    'exit if no selected table
    If err.Number <> 0 Then Exit Sub
    For iRow = 1 To tbl.Rows.Count
    For iCol = 1 To tbl.Columns.Count
    If tbl.Cell(iRow, iCol).Selected Then
    For I = 1 To 3 Step 2
    With tbl.Cell(iRow, iCol)
    .Borders(I).visible = msoTrue
    .Borders(I).ForeColor.RGB = RGB(180, 180, 180)
    .Borders(I).Weight = 0.75
    End With
    Next I
    End If
    Next iCol
    Next iRow


    End Sub

    Code I have tried to use (to only affect the one table for the above code):

    With ActivePresentation.Slides(1).Shapes(1)
    With .TextFrame.TextRange.Font
    .Name = "Arial"
    .Color.RGB = RGB(0, 0, 0)
    End With

    Any chance you can help please? I know you're busy, and a great man for sharing your wisdom, thank you.


  2. #2
    VBAX Regular
    Joined
    Dec 2018
    Posts
    69
    Location
    Hi John, and visitors

    I worked it out! Finally, thanks to reading code you'd published on here. I used this bit and added it near the start:

    Set otbl = ActiveWindow.Selection.ShapeRange(1).Table
    For X = 1 To otbl.Columns.Count
    For Y = 1 To otbl.Rows.Count
    With otbl.Cell(Y, X)
    If .Selected Then
    .Shape.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
    .Shape.TextFrame2.TextRange.Font.Size = 12
    .Shape.TextFrame2.TextRange.Font.Name = "Arial"
    .Shape.TextFrame2.TextRange.Font.Bold = msoFalse
    End If
    End With
    Next 'y
    Next 'x


  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,794
    Location
    That's good. It is always better to learn and do it yourself!
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

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