• Formatting of Pasted Text (Word 2000)

    Author
    Topic
    #402600

    Hi Pauliez:
    I’ve edited the subject to reflect something more meaningful if someone searches in the future.

    This happens because of the rules that Word applies when you cut (or copy) & paste.
    1. Direct formatting is retained. However, certain font properties are toggled (e.g. italic, bold) & so they may take on the opposite properties. i.e. if you copy two words that are formatted as bold & paste them into a paragraph that is already bold, their bold properties will be toggled off.
    2. If you cut/copy text without copying a paragraph mark, they will take on the paragraph style of the target paragraph.
    3. If you copy text which includs a paragraph mark, whose identically named style has been used in the target document, it will take on the properties of the style in the target document. This is probably what is happening to you.

    If you cut/copy MyStyle in source document that uses Arial, bold, green font & paste it into a target document that has used MyStyle already AND that style is defined as TNR, italic, blue font, your pasted text will be TNR, italic & blue. A style is considered used if it every existed in the target document, even if you had later deleted it. Also, normal, Headings 1 through 3 are always considered “used” in every document.

    To prevent this behavior (i.e. you want the text to remain the same when copied), rename the style in the source document to something that doesn’t exist in the target document (e.g. MyOriginalStyle).
    Hope this helps.

    Viewing 3 reply threads
    Author
    Replies
    • #802522

      Thank you guys. I never paid much attention to the styles from one document to another. I set one page to Normal and the target page to normal and the font stayed the same. I learned something new today. Are there any books on line or avaiable that I can study on Word 2000. Please reply

      • #802649

        Hi Paul:
        There are books, but I learned about styles in newsgroups & forums. I like books by Woody (of course smile) & Bill Camarda. If you look in Google advanced groups for posts on styles by John McGhie, you’ll find a lot of good stuff.

        • #802732

          Thank you Phil. I agree with learning from groups like this one. I’ve only had my PC for a little over three years and I am learning something new just about every week mostly from groups and guys like you. Thanks again.

        • #802733

          Thank you Phil. I agree with learning from groups like this one. I’ve only had my PC for a little over three years and I am learning something new just about every week mostly from groups and guys like you. Thanks again.

      • #802650

        Hi Paul:
        There are books, but I learned about styles in newsgroups & forums. I like books by Woody (of course smile) & Bill Camarda. If you look in Google advanced groups for posts on styles by John McGhie, you’ll find a lot of good stuff.

    • #802523

      Thank you guys. I never paid much attention to the styles from one document to another. I set one page to Normal and the target page to normal and the font stayed the same. I learned something new today. Are there any books on line or avaiable that I can study on Word 2000. Please reply

    • #802321

      Subject changed by Phil Rabichow to make it more meaningful for future searches

      I need some help with word. I type a document using a certain font, color and font size and when I am done with that document I try to add it to another word document and the font color, size and type changes. What is causing this to happen. I have run a virus scan thinking it was a virus but that did not correct the problem. Can someone tell me what I could be doing wrong? Please reply

    • #802322

      Subject changed by Phil Rabichow to make it more meaningful for future searches

      I need some help with word. I type a document using a certain font, color and font size and when I am done with that document I try to add it to another word document and the font color, size and type changes. What is causing this to happen. I have run a virus scan thinking it was a virus but that did not correct the problem. Can someone tell me what I could be doing wrong? Please reply

      • #802421

        This is normal Word behaviour.

        What is happening is that your style definitions are different in the two files. When you paste content from one file to another and the paragraph styles are defined in both documents, then the added text adopts the style formats of the host file. There are workarounds but it is easier to ensure that both files use the same style definitions in the first place.

        Post back if you need further assistance in learning how styles work.

      • #802422

        This is normal Word behaviour.

        What is happening is that your style definitions are different in the two files. When you paste content from one file to another and the paragraph styles are defined in both documents, then the added text adopts the style formats of the host file. There are workarounds but it is easier to ensure that both files use the same style definitions in the first place.

        Post back if you need further assistance in learning how styles work.

      • #802323

        How are you adding this file to the other file?

        DaveA I am so far behind, I think I am First
        Genealogy....confusing the dead and annoying the living

        • #802352

          I just go to Edit>Cut> and paste it in another Word Document.

          • #802359

            Instead of using “Cut and Past” use “Copy and Paste” and see if the same thing happens.

            DaveA I am so far behind, I think I am First
            Genealogy....confusing the dead and annoying the living

            • #802392

              Pauliez, do both documents use the same template, e.g., are they both based on normal.dot? If they use different templates and the templates have the same named styles in them, e.g., they both have a style called “Paragraph1” or something else, but the styles have different formatting in them, then when you copy/cut and paste from document A into document B, I do believe the style settings in document B will “take over” the ones from document A. Let us know if this is what might be happening. compute

              Regards,

              Ron M smile smile smile

            • #802393

              Pauliez, do both documents use the same template, e.g., are they both based on normal.dot? If they use different templates and the templates have the same named styles in them, e.g., they both have a style called “Paragraph1” or something else, but the styles have different formatting in them, then when you copy/cut and paste from document A into document B, I do believe the style settings in document B will “take over” the ones from document A. Let us know if this is what might be happening. compute

              Regards,

              Ron M smile smile smile

          • #802360

            Instead of using “Cut and Past” use “Copy and Paste” and see if the same thing happens.

            DaveA I am so far behind, I think I am First
            Genealogy....confusing the dead and annoying the living

          • #803308

            Pauliez,
            What I do (I’m in an organisation where everyone uses their own styles – quite a mess) when I want the formatting of the copied TO document to prevail is to use Edit–>Paste Special–>Unformatted Text. It doesn’t matter if I’ve picked up paragraph marks or other styles it takes the formatting of where I am pasting.

            Since this is what I want as the default – i.e. what happens when I do Ctrl-V for paste I recorded a simple macro with the above three steps, assigned it to a button on my toolbar, and Ctrl-V as its shortcut.

            I also use Paste Special when copying to Outlook (from another outlook document or from word). The results are the same.

            • #803360

              I use a simple macro for that purpose too:

              Sub PastePlainText
              If Documents.Count > 0 Then
              Selection.PasteSpecial DataType:=wdPasteText
              End If
              End Sub

              I assigned Alt+V to this macro in order to preserve the normal use of Ctrl+V.

            • #803394

              My ‘recorded macro’ (Yes I was lazy) is identical except it doesn’t include the line

              “If Documents.Count > 0 Then”

              I’m not sure why I would need this, can you explain?

              I’ve assigned Alt-V to normal Edit–>Paste, for those rare occassions when I need to keep the formatting from the original document.

              Many Thanks

            • #803497

              Documents.Count often is used to determine whether there are any documents open. Many (most?) operations cause an error if there are no documents open. The macro recorder doesn’t really care about fine points like that. grin

            • #803856

              Thanks Jefferson,
              I guessed that was the reason, and in fact it does generate a run-time error ’91’ if I use it without an open document (something I hadn’t actually tried before evilgrin). In any case I’ve updated my Macro to include it. thankyou

            • #803857

              Thanks Jefferson,
              I guessed that was the reason, and in fact it does generate a run-time error ’91’ if I use it without an open document (something I hadn’t actually tried before evilgrin). In any case I’ve updated my Macro to include it. thankyou

            • #803498

              Documents.Count often is used to determine whether there are any documents open. Many (most?) operations cause an error if there are no documents open. The macro recorder doesn’t really care about fine points like that. grin

            • #803395

              My ‘recorded macro’ (Yes I was lazy) is identical except it doesn’t include the line

              “If Documents.Count > 0 Then”

              I’m not sure why I would need this, can you explain?

              I’ve assigned Alt-V to normal Edit–>Paste, for those rare occassions when I need to keep the formatting from the original document.

              Many Thanks

            • #804330

              There are other errors that you need to trap in this macro, for example if the paste buffer contains a graphic you may see Error 5342 “The specified data type is unavailable”.

              I think the easiest way to code a macro to do this is to have an error handler that dismisses all errors. That way it will paste the unformatted text if it can and silently do nothing if it cant.

              Public Sub PastePlainText()
              On Error GoTo Done
              Selection.PasteSpecial DataType:=wdPasteText
              Done:
              Err.Clear
              Exit Sub
              End Sub

              StuartR

            • #804546

              Hi Stuart,

              I don’t agree, because when nothing is copied into the doc and no error message is shown, the user will tend to call the help desk…
              So you have to cater for that. The reason I didn’t include that in my previous post is, that all my messages are in Dutch and I had not much time to spent translating. So here comes the complete code:

              Public Sub PastePlainText

              On Error Goto Error_Handler

              If Documents.Count > 0 then
              Selection.PasteSpecial DataType:=wdPasteText
              End If

              Exit_Error:
              Exit Sub

              Error_Handler:
              Select Case Err.Number
              Case 4605
              MsgBox “There’s nothing on the Clipboard…”, vbInformation + vbOKOnly
              Case 4198, 5342
              MsgBox “The contents of the Clipboard cannot be pasted as plain text.”, vbInformation + vbOkOnly
              Case Else
              MsgBox “Error : ” & Err.Number & vbCrLf & “Description: ” & Err.Description, vbInformation + vbOkOnly, “PastePlainText”
              End Select
              Resume Exit_Error
              End Sub

              The Exit_Error bit is there to always create a single point of exit for a Sub/Function. On many occasions some code sits between the Exit_Error and Exit Sub lines. E.g. turning on document protection if that was turned off earlier in that Sub, to avoid problems with documents containing FormFields.

            • #804741

              I absolutely agree with you, nice Macro.

              StuartR

            • #804742

              I absolutely agree with you, nice Macro.

              StuartR

            • #804889

              and I. My nice simple one line Macro is now much improved. thankyou cheers

            • #804890

              and I. My nice simple one line Macro is now much improved. thankyou cheers

            • #804331

              There are other errors that you need to trap in this macro, for example if the paste buffer contains a graphic you may see Error 5342 “The specified data type is unavailable”.

              I think the easiest way to code a macro to do this is to have an error handler that dismisses all errors. That way it will paste the unformatted text if it can and silently do nothing if it cant.

              Public Sub PastePlainText()
              On Error GoTo Done
              Selection.PasteSpecial DataType:=wdPasteText
              Done:
              Err.Clear
              Exit Sub
              End Sub

              StuartR

            • #803361

              I use a simple macro for that purpose too:

              Sub PastePlainText
              If Documents.Count > 0 Then
              Selection.PasteSpecial DataType:=wdPasteText
              End If
              End Sub

              I assigned Alt+V to this macro in order to preserve the normal use of Ctrl+V.

            • #803669

              I will try your idea. I have never messed with Macros or at least I don’t think I have. Thank you for your help.

            • #803858

              To start, have an open document, and something copied to your clipboard. Then select Tools–>Macro–>Record New Macro and follow the instructions from there. If you need help try the VB forum. Lots of experienced loungers, although many there may recommend you stay away from ‘recording’ – (note the exchange on the extra line of code) but for something as simple as this its a good place to start.

              Good Luck (not that you need it)

            • #803859

              To start, have an open document, and something copied to your clipboard. Then select Tools–>Macro–>Record New Macro and follow the instructions from there. If you need help try the VB forum. Lots of experienced loungers, although many there may recommend you stay away from ‘recording’ – (note the exchange on the extra line of code) but for something as simple as this its a good place to start.

              Good Luck (not that you need it)

            • #803670

              I will try your idea. I have never messed with Macros or at least I don’t think I have. Thank you for your help.

          • #803309

            Pauliez,
            What I do (I’m in an organisation where everyone uses their own styles – quite a mess) when I want the formatting of the copied TO document to prevail is to use Edit–>Paste Special–>Unformatted Text. It doesn’t matter if I’ve picked up paragraph marks or other styles it takes the formatting of where I am pasting.

            Since this is what I want as the default – i.e. what happens when I do Ctrl-V for paste I recorded a simple macro with the above three steps, assigned it to a button on my toolbar, and Ctrl-V as its shortcut.

            I also use Paste Special when copying to Outlook (from another outlook document or from word). The results are the same.

      • #802324

        How are you adding this file to the other file?

        DaveA I am so far behind, I think I am First
        Genealogy....confusing the dead and annoying the living

    Viewing 3 reply threads
    Reply To: Formatting of Pasted Text (Word 2000)

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

    Your information: