Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Mar 2014
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Problems creating first macro

    This is very frustrating. I am trying to create my first Macro.
    I would like to insert an empty simple text box whenever I
    press the Insert Key. When I try to create this Macro, I get
    the exact same error message Dave obtained in
    http://windowssecrets.com/forums/sho...l=1#post800595.

    Also, if I reassign the Insert key to run this Macro, how
    do I fix a situation when for some reason my keyboard
    magically goes into destructive Overtype mode, instead
    of Insert mode.

    I need things explained in simple English. I am not a programmer.

    I do not understand why the MS Word 2013 Macro function
    does not work.

    _____________________________________________


    I am trying to insert a simple text box when I press the "Insert"
    key on my keyboard.

    As it so happens, I followed the exact steps Dave followed
    before I read his message here. I get the exact same error
    message. What is wrong with MS Word 2013. Why does it
    never work like any normal person would expect it to?

    I also get the following error:
    When I try to run the macro, I get a Microsoft Visual Basic error window, saying:

    ====================================
    Run-Time Error
    '-2147024809(80070057)'
    The item with the specified name wasn't found.

    ____________________________________________

    Here is the Macro.
    The line that reads: "ActiveDocument.Shapes.Range(Array("Text Box 2")).Select"
    is highlighted in yellow.

    Why doesn't MS Macro work as advertised?

    When I try to assign the Macro to another key like
    "Insert" followed by "F12" I get a different error
    message. I thought at first the problem was
    "Insert" was already assigned to perform another
    task.

    I would like to reassign the "Insert" key to perform this
    task, but worry what I will do if my keyboard goes
    rogue as it sometimes does and starts destructive
    overtyping text instead of inserting text.

    Sub Text Box()
    '
    ' Text Box Macro
    ' Create a simple text box
    '
    ActiveDocument.Shapes.Range(Array("Text Box 2")).Select
    Application.Templates( _
    "C:\Users\Owner\AppData\Roaming\Microsoft\Docu ment Building Blocks\1033\15\Built-In Building Blocks.dotx" _
    ).BuildingBlockEntries(" Simple Text Box").Insert Where:=Selection.Range, _
    RichText:=True
    Selection.TypeBackspace
    Selection.TypeText Text:="Text"
    Selection.EscapeKey
    Selection.Collapse
    End Sub
    ____________________________

    I have so many problems with MS Word 2013, I often
    feel like jumping off a building. When I edit points on
    object and choose "Tight" to wrap words around the
    object, words disappear under the original outline of
    the object. The edit points work to the degree the
    text is not longer stopped by the outer boundaries
    of the image or object, but this feature is useless as
    the words now flow under the image and can't be
    seen. I tried moving the image behind text, but that
    didn't help. I tried to move the object to the back,
    backwards, behind text but that didn't help. This
    feature worked for me in MS Word 2010.

    _____________________________________
    Last edited by macropod; 2014-03-23 at 02:28. Reason: Merged posts & deleted two separate quotes of entire post referenced

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,898
    Thanks
    0
    Thanked 188 Times in 172 Posts
    Quote Originally Posted by Frank Shore View Post
    This is very frustrating. I am trying to create my first Macro.
    I would like to insert an empty simple text box whenever I
    press the Insert Key.
    That would be quite unwise - you should choose a key combination that isn't otherwise used. To use the Insert key, you'd not only need to assign the macro to it, but also disable its normal functions. Aside from that, my reply (http://windowssecrets.com/forums/sho...l=1#post800637) in post #2 in that thread shows all that is needed to insert a textbox. You can, of course, change the size & positioning.

    As for:
    The line that reads: "ActiveDocument.Shapes.Range(Array("Text Box 2")).Select"
    is highlighted in yellow.
    that code has nothing to do with inserting a textbox. What that code is trying to do is select a textbox already in the document and named 'Text Box 2', but the syntax used is entirely wrong. Assuming the textbox exists, the correct code would be:
    ActiveDocument.Shapes.("Text Box 2").Select

    PS: Please don't: quote entire posts referenced; or resurrect old threads. Also, if you find a thread dealing with a related topic that's been resolved, take time to see how the discussion might apply to your own situation. As I said above, post #2 in that thread addresses all the essential aspects. Also, when posting code, please use the code tags. They're on the 'Go Advanced' tab. Finally, I've split your two posts off into a new thread and merged them.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    Frank Shore (2014-03-24)

  4. #3
    4 Star Lounger
    Join Date
    Mar 2014
    Location
    Forever West
    Posts
    492
    Thanks
    0
    Thanked 43 Times in 43 Posts
    f I reassign the Insert key to run this Macro, how do I fix a situation when for some reason my keyboard magically goes into destructive Overtype mode, instead of Insert mode.
    Have you tried a different keyboard? Have seen times where pressing the adjacent key carried over to the desired key. It can be caused by spillage on the keyboard or crumbs in it causing a cross-signal on the printed circuit in it.

  5. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts
    Try this little macro to insert a new text box. When you record a macro, every keystroke is included in the code. Not everything is useful when you run that macro. It looks like your macro created a new text box which Word randomly named Text Box 2. When your macro runs again, apparently there is nothing called Text Box 2.

    Code:
    Sub InsertTextBox()
    
        If Documents.Count = 0 Then Exit Sub
        
        Dim objTB As Shape
        Set objTB = ActiveDocument.Shapes.AddTextBox(Orientation:=msoTextOrientationHorizontal, _
                        Left:=100, Top:=100, Width:=65, Height:=65)
        With objTB
            .RelativeHorizontalPosition = wdRelativeHorizontalPositionCharacter
            .RelativeVerticalPosition = wdRelativeVerticalPositionLine
            .Left = wdShapeLeft
            .Top = wdShapeTop
        End With
    
    End Sub

  6. #5
    New Lounger
    Join Date
    Mar 2014
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    I can't seem to edit my posts.

    I can't seem to edit my posts.

    When I click on the "Save" button nothing happens.

    What happened to my auto-saved messages? I lost a message that took me hours to write.

    Sometimes I see at the top of the page:

    "Answer yes or no."

    But there is no question. This time there is a question.

    "A basketball for midgets could be smaller than a baseball for giants." Clearly, the person who thought up these questions never played basketball or baseball in other worlds.

  7. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,898
    Thanks
    0
    Thanked 188 Times in 172 Posts
    Frank,

    Q. Why is using the Ins key unwise?
    A. because it toggles on/off the Insert mode - which explains your issues with:
    my keyboard magically goes into destructive Overtype mode
    I also said what you'd need to do to avoid that. The Ins has a specific function - toggling Insert/Overtype mode. Simply assigning it to a macro as well doesn't change that. If you don't want to be alerted to the pitfalls of what you're proposing to do, don't tell us.

    You also say:
    It is nearly impossible to choose a key combination that isn't used.
    which is absolute nonsense. If you want to know which keystroke combinations are used, see: http://office.microsoft.com/en-us/wo...005186664.aspx. The rest aren't. If there's a combo there you'd like to use for something else, go ahead.

    Re:
    Unless you are volunteering to move in with me, and become my full-time programmer, I don't see how this is going to work out.
    Did you my code with yours and ask yourself why mine worked without anything like "ActiveDocument.Shapes.Range(Array("Text Box 2")).Select" but yours failed with it? Your response suggests not.

    Re:
    I need to know why MS Word 2013 is not working as advertised. Is this a bug?
    Oh, but it does, it's just that you're not competent enough to understand what you've done wrong...

    As for:
    You should be sharing this information with some MS employee, not me.
    it's about time you accepted that the fault is not with MS but is located firmly between your seat & keyboard. What you've recorded there is the selection of an existing textbox (which I suspect you subsequently deleted), not the creation of a new one.

    Re:
    I did not wish to quote anything at all.
    Then why on earth did you twice use the 'Reply with Quote' option instead of the 'Reply' or 'Quick Reply' options?

    Re:
    I didn't know this was an old thread.... I don't know how to create a new thread. I found this post by Gurgling the problem I had
    Did you look at how long ago the last post in that thread was made??? What do you suppose the 'Post New Thread' button is for? Did you look at the FAQ topic 'Posting a New Thread' at http://windowssecrets.com/forums/faq...aq=soon#faq_a? As for Gurgling your problems, that boggles the mind... I think I'll leave that one alone.

    Re:
    You will notice that Dave also was not happy with the solution posted in post #2. We both were looking for a solution that works all the time, not just happens to work in this one instance.
    And you managed this amazing in-depth analysis how? When doesn't the code I posted work?

    Frank, on the whole, your tone is aggressive and unreceptive. If you want help here or anywhere else, I suggest you change it.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •