none
automation PowerPoint 2007/2010 Fill.visible = false not working anymore in 2010? RRS feed

  • Question

  • Hi, i try to set the Fill state of a table or shape in Powerpoint 2010 with VB.net or VBA (nothing works). In PP2007 i only set "Shape/Table.Fill.Visible = False" and then the Fill is set to "none". Then i try this in PP2010 and nothing happens. The variable Fill.Visible is "readonly" in Office 2010? A workaround with setting transparency too 100% is not a realy good soloution. Cause of the fact that i can apply the Fill too "none" with the GUI. Greeting RealStein
    Tuesday, May 24, 2011 9:12 AM

Answers

  • Here's VBA code that works correctly in Office 2010 32-bit:

    Private Sub test()
    Dim PowerPointApp As PowerPoint.Application
      Set PowerPointApp = GetObject(, "PowerPoint.Application")
    Dim selectedShapes As PowerPoint.ShapeRange
      Set selectedShapes = PowerPointApp.ActiveWindow.Selection.ShapeRange
    Dim sh As PowerPoint.Shape
      Set sh = selectedShapes.Item(1)
      sh.Fill.Visible = msoFalse
    End Sub


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by Bruce Song Thursday, June 2, 2011 12:34 PM
    Monday, May 30, 2011 9:28 AM

All replies

  • Hello,

    Try "Shape.Fill.Visible = msoTriState.msoFalse" instead. Note that msoTriState is declared in Office, not in PowerPoint.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Thursday, May 26, 2011 10:22 AM
  • pShape.Fill.Visible = MsoTriState.msoFalse
    ' Workaround for PP 2010 cause above not work!
    If pShape.Fill.Visible = MsoTriState.msoFalse Then
      Return True
    Else
      pShape.Fill.Transparency = 1 ' 100% -> invisible
    End If
    


    This is my workaround.

    @Andrei:

    I allready use this msoTriState.msoFalse. It seems not to work for setting to false, but setting true is working. Strange! Maybe an bug in PP?

    Monday, May 30, 2011 8:17 AM
  • Here's VBA code that works correctly in Office 2010 32-bit:

    Private Sub test()
    Dim PowerPointApp As PowerPoint.Application
      Set PowerPointApp = GetObject(, "PowerPoint.Application")
    Dim selectedShapes As PowerPoint.ShapeRange
      Set selectedShapes = PowerPointApp.ActiveWindow.Selection.ShapeRange
    Dim sh As PowerPoint.Shape
      Set sh = selectedShapes.Item(1)
      sh.Fill.Visible = msoFalse
    End Sub


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by Bruce Song Thursday, June 2, 2011 12:34 PM
    Monday, May 30, 2011 9:28 AM