Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    As part of my template, I provide a macro to add a textbox to the left of the current paragraph/table row/etc to indicate changes in a particular version of the software etc. This macro works perfectly. The problem is that the users would like to run the macro *once* & then just copy or move the textbox to another paragraph etc. Now, what happens is that the textbox disappears when moved to another location/paragraph. For example, move it down verticall & it disappears!. Also, should I consider using frames instead of textboxes although I don't know much about frames so it may be an irrelevant question.

    Incidently, the template has the page set-up as follows: T= 1, B=1, L=2, R=1 inches. The textbox is to the left of the normal paragraph. See snapshot.

    The macro is as follows:
    Code:
    Sub InsertNewInFlash()
    '
    ' Inserts a new in flash text box
    '
        Dim myTBox As Shape
        Dim curSec As Variant
        
       if ( Selection.Paragraphs(1).Style <> ActiveDocument.Styles (wdStyleHeading1) And _
            Selection.Paragraphs(1).Style <> ActiveDocument.Styles (wdStyleHeading2) And _
            Selection.Paragraphs(1).Style <> ActiveDocument.Styles (wdStyleHeading3) ) Then
            
            StartUndoSaver
            
            ' Switch off screen updates
            Application.ScreenUpdating = False
    
            ' Insert a 'New in v' text box flash to the left of current selection
            Set myTBox = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
                                                          InchesToPoints(-1#), _
                                                          InchesToPoints(-0#), _
                                                          45#, _
                                                          25, _
                                                          Selection.Range)
            With myTBox
                .TextFrame.MarginTop = InchesToPoints(0#)
                .TextFrame.MarginLeft = InchesToPoints(0#)
                .TextFrame.MarginRight = InchesToPoints(0#)
                .TextFrame.MarginBottom = InchesToPoints(0#)
          
                .TextFrame.TextRange.ParagraphFormat.Style = FLASHINFO
                .TextFrame.TextRange = "New in v"
            
                .Line.Visible = msoFalse
                .LockAnchor = False
            
                .WrapFormat.Type = 3
                .ZOrder msoBringInFrontOfText
                
                .Select
            End With
            
            Application.ScreenUpdating = True
            
            StopUndoSaver
        End If
    End Sub
    Attached Images Attached Images
    Thanks.
    Robie

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  4. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  5. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  6. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  7. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  8. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  9. #8
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  10. #9
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 27 Times in 26 Posts
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary

  11. #10
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

  12. #11
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

  13. #12
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

  14. #13
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

  15. #14
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

  16. #15
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gary Frieder View Post
    Hi Robie,

    Haven't had a chance to run your code, but was wondering if you might get a better-behaved textbox if you inserted it as an autotext (that you had previously created manually and saved as an autotext in your template), rather than creating it from scratch each time programatically - anyway, that's how I insert textboxes, and they seem to behave well.

    Frames are a somewhat deprecated feature and in any case, they are inline with text, which probably wouldn't work with the kind of layout requirement you have here.

    Gary
    That's an interesting thought Gary. There must have been a reason why I am creating it everytime but I can't remember now. The only thing is that this textbox is locked to the current paragraph and therefore needs to move with it if info is added before that paragraph. Would that be possible with autotexted(is that a new word) textbox?

    I will try your Autotext method. Presumeablly, I can move the autotexted textbox once added to a paragraph! Then add a textbox and move it arround, and see whether it disappears or not.
    Thanks.
    Robie

Page 1 of 2 12 LastLast

Posting Permissions

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