locked
macro recorder can't record shapes in word 2010 RRS feed

  • Question

  • In word 2010 when I use the macro recorder to insert shapes, the recorder does not record the steps.  It works in Excel 2010. Is there a fix, other than creating macro in Visual Basic.?


    Tish Zlockie
    Friday, February 18, 2011 7:59 PM

All replies

  • No, there are many things that the macro recorder cannot handle and while it can be useful to determine the required syntax in some circumstances, you really need to use the Visual Basic Editor.


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "mjzpaz72" wrote in message news:33af3991-fb3b-4edd-8c1f-7916a0f8f65f@communitybridge.codeplex.com...

    In word 2010 when I use the macro recorder to insert shapes, the recorder does not record the steps.  It works in Excel 2010. Is there a fix, other than creating macro in Visual Basic.?


    Tish Zlockie


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Proposed as answer by Charles Kenyon Thursday, August 10, 2017 11:45 AM
    Friday, February 18, 2011 9:46 PM
  • Thank you for resonding.  I was able to use macro recorder to insert shapes in Word 2007 so I was puzzled that it did not work in Word 2010, yet, my coworker, is able to record shapes in Word 2010. Rather puzzling.
    Tish Zlockie
    Monday, February 21, 2011 12:14 PM
  • I am experiecing same issue. Macro is empty if assigned to shapes in word 2010. However, it works on another computer that Office 2010 though. Will figure out whether some update or setting is causing the issue.

    As a workaround, copy code from Word 2007 and paste in 2010 Macros by clicking Macros> View Macros> Edit . Example:

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    '
        ActiveDocument.Shapes.AddConnector(msoConnectorStraight, 114#, 52.5, _
            174#, 111#).Select
        Selection.ShapeRange.Flip msoFlipHorizontal
    End Sub

    Friday, May 13, 2011 10:44 PM
  • In Word 2010, if I am working with a newly created and already saved .DOC file (not a .DOCX), the macro recorder will record the commands I issue with the mouse to draw a picture. Then the macro will faithfully recreate those steps and draw the same picture.

    However, if I am editing a newly created .DOCX file, the macro recorder will not record my drawing efforts, and instead produces an empty subroutine.

    Additionally, while in the .DOCX file, the drawing macro I created while editing as a .DOC will not always work correctly -- in particular, "line" does not faithfully reproduce, though it seems "curve," "freeform," and "scribble" do.

    In a .DOC file, in Word 2010, this macro produces an isosceles triangle:

        Sub triangle()

          ActiveDocument.Shapes.AddConnector(msoConnectorStraight, 200, 100, 20, 30).Select

          ActiveDocument.Shapes.AddConnector(msoConnectorStraight, 220, 130, -40, 0).Select

          ActiveDocument.Shapes.AddConnector(msoConnectorStraight, 180, 130, 20, -30).Select

        End sub

    Here, it seems, the second set of coordinates in each instruction is a delta for how much either the X or Y should change.  So in the first example, it doesn't draw from (200,100) to (20,30), instead it draws from (200,100) to (200+20, 100+30).

    That same subroutine produces a mess inside a DOCX file.  There, it seems, it considers those two sets of absolute coordinates, not a set of coordinates and then an offset. 

    But back to macros:  when using Word 2010 to edit a .DOC file, there's a number of mouse-related commands I'm able to record with the macro recorder. The same does not hold true if I am editing a .DOCX file.


    • Edited by XianZomby Friday, December 30, 2011 3:59 AM
    • Proposed as answer by GeorgeMc Tuesday, December 4, 2012 12:37 AM
    Friday, December 30, 2011 3:57 AM
  • "XianZomby" wrote in message news:317fdd4a-e76e-4bbb-8f98-8f5123a71d3f@communitybridge.codeplex.com...
    In Word 2010, if I am working with a newly created and already saved .DOC file (not a .DOCX), the macro recorder will record the commands I issue with the mouse to draw a picture. Then the macro will faithfully recreate those steps and draw the same picture.
     
    However, if I am editing a newly created .DOCX file, the macro recorder will not record my drawing efforts, and instead produces an empty subroutine. [---]
     
     
     
    This is probably connected to the new graphics engine supported by the new file formats, but whether it’s a bug or “by design” is hard to tell.

    Stefan Blom, Microsoft Word MVP
    Monday, January 2, 2012 8:57 AM
  • Excellent work XianZomby - I use macro recording to help me explore the Word API when developing add-ins - and had I not read your reply, I would have given up on this method in Word 2013.

    Your workaround works in Word 2013 - I thank you, and I think it should be an answer to this thread until Microsoft fixes macro recording.

    To pick up on Stefan's reply below, for me, as a developer creating solutions that integrate with MS Word, there is no "hard to tell" about this - not having fully capable macro recording is a bug.

    "By design" is Microsoft newspeak for "because your requirements are not sufficiently important to us". To be fair, "by design" is easier to say.

    Cheers,

    George.

    Tuesday, December 4, 2012 12:37 AM
  • Excellent work XianZomby - I use macro recording to help me explore the Word API when developing add-ins - and had I not read your reply, I would have given up on this method in Word 2013.

    Your workaround works in Word 2013 - I thank you, and I think it should be an answer to this thread until Microsoft fixes macro recording.

    To pick up on Stefan's reply below, for me, as a developer creating solutions that integrate with MS Word, there is no "hard to tell" about this - not having fully capable macro recording is a bug.

    "By design" is Microsoft newspeak for "because your requirements are not sufficiently important to us". To be fair, "by design" is easier to say.

    Cheers,

    George.


                       

    To clarify, I'm not speaking on Microsoft's behalf (none of the MVPs are). Microsoft decides what needs fixing. You can post a suggestion to improve the macro recording at https://feedback.office.microsoft.com/default.aspx?scrx=1.

    Also, note that macro recording has never been flawless (but you are right: in some respects it isn't working as well now as it used to in older versions).


    Stefan Blom, Microsoft Word MVP

    Tuesday, December 4, 2012 7:40 AM
  • Thanks very much!  I was going bonkers trying to figure this out.  

    I regularly annotate users' screenshots with shapes and arrows for my helpdesk job, and before I upgraded to Win10 I forgot to make a copy of my normal.dotm template with all my macros.  

    I had initially recorded the shape macros in Word 2007 with a blank .DOCX file, and continued to use them when I got 2010.  But on my Win10 system with Word 2010, like other users, it was just not capturing my mouse clicks for drawings, resulting in empty code.  Your suggestion of creating them in a .DOC file instead worked like a charm!

    Cheers!

    Wednesday, August 9, 2017 6:10 PM