0

necesito dar color al texto de esta tabla pero no logro realizarlo, tambien necesito poner borde de color negro.

Sub Tabula()
    
    Dim oSh As Shape
    
    Dim Tabla As Table
    
    Set oSh = ActivePresentation.Slides(1).Shapes.AddTable(2, 4)
    
    Set Tabla = oSh.Table
    
    
    With Tabla.Cell(1, 1).Shape.TextFrame2
    .TextRange.Font.Size = 8
    
    End With
    
    With Tabla.Cell(1, 1).Shape.Fill
    .ForeColor.RGB = RGB(255, 255, 255)
    .ForeColor.RGB = RGB(255, 0, 0)
    End With
    
    With Tabla.Cell(1, 1)
    
        .Shape.TextFrame.TextRange.Delete
        .Parent.Columns(1).Width = 300
    
    End With
    
    
    With Tabla.Cell(1, 2).Shape.TextFrame2
    .TextRange.Text = "1"
    .TextRange.Font.Size = 8
    End With
    With Tabla.Cell(1, 2).Shape.Fill
    .ForeColor.RGB = RGB(255, 255, 0)
    End With
    
    
    
    
    With Tabla.Cell(1, 3).Shape.TextFrame2
    .TextRange.Text = "2"
    .TextRange.Font.Size = 8
    End With
    With Tabla.Cell(1, 4).Shape.Fill
    .ForeColor.RGB = RGB(255, 128, 0)
    End With

    With Tabla.Cell(1, 4).Shape.TextFrame2
    .TextRange.Text = "3"
    .TextRange.Font.Size = 8
    End With
    With Tabla.Cell(1, 4).Shape.Fill
    .ForeColor.RGB = RGB(255, 0, 0)
    End With
    
    
    
    End Sub

1 respuesta 1

1

Prueba del siguiente modo; no olvides que los bucles están definidos por el número de filas y columnas que estás insertando con la tabla, pero si se requiriera podría hacerse con variables. Ah, asumí que necesitas cambiar el color de cada borde de cada celda (excepto las diagonales).

Sub PintarTodo()

Dim f As Integer, c As Integer
Dim oSh As Shape
Dim Tabla As Table
    
Set oSh = ActivePresentation.Slides(3).Shapes.AddTable(2, 4)
Set Tabla = oSh.Table

For f = 1 To 2

    For c = 1 To 4
    
        With Tabla.Cell(f, c)
            
            With .Shape.TextFrame
                .TextRange.Text = "3"
                .TextRange.Font.Size = 8
                .TextRange.Font.Color.RGB = RGB(200, 100, 9)
            End With
            
            With .Borders
                .Item(ppBorderTop).Visible = msoCTrue
                .Item(ppBorderBottom).Visible = msoCTrue
                .Item(ppBorderLeft).Visible = msoCTrue
                .Item(ppBorderRight).Visible = msoCTrue
                .Item(ppBorderTop).ForeColor.RGB = RGB(0, 0, 0)
                .Item(ppBorderBottom).ForeColor.RGB = RGB(0, 0, 0)
                .Item(ppBorderLeft).ForeColor.RGB = RGB(0, 0, 0)
                .Item(ppBorderRight).ForeColor.RGB = RGB(0, 0, 0)
          End With
            
        End With
        
    Next c

Next f

End Sub

Si no hace el 100% tal cual necesitas, sugiero modificar lo necesario. Saludos.

1
  • gracias, probare y te comento como me va, lo siento por el retraso.
    – Daxtrox
    el 16 nov. 2022 a las 14:44

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.