Naming Freeform Objects

  • When the freeform tool is used to draw a shape the "Name Box" in Excel displays a default name. e.g. Freeform 6.


    Is it possible to change the default name given in the "Name Box". i.e to change "Freeform 6" to "FunnyShape"?


    I have tried usign insert>name>define this seems to work but I am unable to access it using a macro.


    Appreciate any Help.

  • Re: Naming Freeform Objects


    Rennie,


    You can change the name of the freeform shape either via the Name Box or with VBA like the following sample shows:


    [vba]
    Option Explicit


    Sub Change_FreeForm()
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim oShape As Shape


    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets(1)


    With wsSheet
    Set oShape = .Shapes(1)
    End With


    oShape.Name = "Rennie"


    Debug.Print oShape.Name



    End Sub
    [/vba]


    There are also other approaches but as You work with Freeform this may be the best choice from a logical point of view.

  • Re: Naming Freeform Objects


    not sure if this is what you're looking for. you should be able to change the name of the shape by just typing the new name in the Name Box you can do it through code too


    Code
    ActiveSheet.Shapes("Freeform 2").Select
        Selection.Name = "FunnyShape"
        Selection.ShapeRange.ScaleWidth 1.37, msoFalse, msoScaleFromTopLeft
        Selection.ShapeRange.ScaleHeight 1.4, msoFalse, msoScaleFromTopLeft
        Selection.ShapeRange.IncrementLeft -59.25
        Selection.ShapeRange.IncrementTop 83.25

    :drum: The worst moment for the atheist is when he is really thankful and has nobody to thank.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!