• Shape formating (2003)

    Author
    Topic
    #427514

    I’m trying to create a shape, rename, resize and reposition on the current page. Any ideas.

    Viewing 0 reply threads
    Author
    Replies
    • #990752

      Try recording a macro. The generated code will not be the most efficient, but it will give you an idea of the code needed for this. (I assumed that you wanted VBA code)

      • #990753

        It wont record the name changes to the shape(checkbox)

        • #990755

          Perhaps not surprisingly, you can use the Name property of a Shape object.

          • #990820

            I can’t seem to make it create the new shape on the current page rather than the top of the document. I’m using the attached.

            • #990822

              Try changing
              .AddOLEControl(ClassType:=”Forms.CheckBox.1″)

              to
              .AddOLEControl(ClassType:=”Forms.CheckBox.1″, Anchor:=Selection.Range)

              StuartR

            • #990828

              Works well. I’m trying to stack this to create 4 check-shapes. The only difference between the four is the name and left position. Can you think of another way to do this. Perhaps with a loop. Stacking these is causing some problems with word.

            • #990829

              Stack?

              What about this:

              Dim i As Integer
              For i = 1 To 4
              With ActiveDocument.Shapes.AddOLEControl( _
              ClassType:=”Forms.CheckBox.1″, _
              Anchor:=Selection.Range)
              .Width = 12
              .Height = 9
              .Top = -52.2
              .Left = 72 * i
              .OLEFormat.Object.Value = False
              .Name = “aud” & i
              End With
              Next i

            • #990830

              I was stacking the attached code to get four check-shapes. It’s really close to what i’m looking for. I’ll work on it for awhile before asking another dumb question.

            • #990953

              HansV i’m using the attached code. It rarely works and most times hangs Word up. I’m running this sub after another macro which finishes with a save. If it didn’t hang up word it would be perfect. Any suggestions?

            • #990959

              It’s not entirely clear what you want to do. If you want to add check boxes to each section, you should change

              fcount = ActiveDocument.Sections.Count

              to

              fcount = Selection.Information(wdActiveEndSectionNumber)

              otherwise, the code will try to assign the same names to the check boxes regardless of which section the selection is in when the macro is run. You can use Select Case … End Select to streamline the code a bit – see attached version.

    Viewing 0 reply threads
    Reply To: Shape formating (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: