2014-12-02 64 views
-1

我有一张幻灯片上的PowerPoint 2010演示文稿。 我想创建一个VBA无模式表单,它将像格式/颜色的格式一样工作,用于格式化该表格的单元格。 基本上,窗体上的按钮只会模拟在表格工具/设计菜单中点击特定的着色颜色。VBA powerpoint - 更改表格单元格阴影的代码

例如:

我光标放置到细胞然后在活化无模式形式的按钮。该单元格的阴影将根据代码中的颜色而改变。

我想这样做的原因是,其他一些人会用它和颜色必须是方便(格式刷不似乎并没有复制的阴影)

但我不能找到一种方法,制作这个VBA。我曾尝试在Word中记录宏(不可能在PP中),但没有成功。

+0

马可记录不是在PowerPoint中使用,我想它在Word中,但代码不在powerpoint工作。在Excel中录制也给出了一个不可用于PowerPoint的代码。 – user2523971 2014-12-03 09:01:26

回答

0

尝试......(未抛光的代码,但应该给你你需要什么(ED))

Public sub TblCellColorFill() 

    Dim X As Integer 
    Dim Y As Integer 
    Dim oTbl as Table 

    set oTbl = ActiveWindow.Selection.Shaperange(1).Table 'Only works is a single table shape is selected - add some checks in your final code! 

     For X = 1 To otbl.Columns.Count 

      For Y = 1 To otbl.Rows.Count 

       With otbl.Cell(Y, X) 

        If .Selected <> False Then 'Strange bug - will ignore if statement entirely if you use "= True" 
         'Debug.Print "Test worked " & Now 

         'We have the shape we need 
         .shape.Fill.ForeColor.RGB = RGB(100, 150, 200) 'Add your color here 

        End If 
       End With 
      Next 'y 
     Next 'x 
    End Sub