none
format a rectangle RRS feed

  • Question

  • Hi,

    Can I format a shape (rectangle) to no fill and at the same time show fonts in black and visible in that shape ? with vba ?

    regards

    Wednesday, March 16, 2016 3:59 PM

Answers

  • Hi, drsantoshsinghrathore

    Try the following code.

    Sub demo()
    Set shp = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 100, 20, 200, 100)
      shp.Select
      Selection.ShapeRange.Fill.Visible = msoFalse
      Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "hello"
      shp.TextFrame.Characters.Font.ColorIndex = 1
    shp.TextFrame.HorizontalAlignment = xlHAlignCenter
     shp.TextFrame.VerticalAlignment = xlVAlignCenter
     End Sub
    

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Thursday, March 17, 2016 7:05 AM
    Moderator