2016-07-06 2 views
1

모든 슬라이드를 반복하고 표의 텍스트를 검정색으로 변경하는 매크로가 필요합니다. 아래 코드를 실행하면 Method 'Table' of 'Shape' failed이라는 오류 메시지가 나타납니다.텍스트 테이블을 변경하는 코드 모든 슬라이드의 색

Sub TableAllBlack() 

Dim lRaw As Integer 
Dim lCol As Integer 
Dim oTbl As Table 
Dim osld As Slide 
Dim oShp As Shape 

With ActivePresentation 
    For Each oSl In .Slides 
     For Each oSh In oSl.Shapes 
      Set oTbl = oSh.Table 
       With oTbl 
        For lRow = 1 To .Rows.Count 
          For lCol = 1 To .Columns.Count 
           With .Cell(lRow, lCol).Shape 
            If .HasTextFrame Then 
             If .TextFrame.HasText Then 
              TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0) 
             End If 
            End If 
           End With 
          Next 
        Next 
       End With 
      Next 
     Next 
End With 


End Sub 

답변

1

아니 모든 형태는 그와 관련된 테이블이 있습니다

내 코드입니다. 그냥 문 If oSh.HasTable Then...을 추가 그리고

If 문을 작동해야 테이블의 모든 호출을 캡슐화하기 위해 배치해야하므로

+0

이 ypur 답변을 주셔서 감사합니다 Set oTbl = oSh.Table 라인 바로 앞에 배치! 나는 여전히 줄에 실수가 하나있다 : TextFrame.TextRange.Font.Color.RGB = RGB (0, 0, 0). 항상 필요한 개체가옵니다! 나는 어떻게해야합니까? Thanks – Zigouma

+0

@Zigouma TextFrame 이전에 클립을 추가하십시오 – RGA