Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Michigan, USA
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force pasted text to use document styles? (2002)

    Hi everyone, thanks for reading. I have a template that uses about 15 styles. When someone pastes text into the template, I would like the template to convert the pasted text into the template's text style. I don't want the pasted text to retain it's own formatting - it should use the style from the template instead. How can I do this? Thank you kindly for any help!

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (200

    The formatting rules that Word follows for pasted text are:
    1. Unformatted text takes on the formatting of the target paragraph style.
    2. Text with direct formatting keeps it

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (2002)

    Exactly for that purpose I added a button to the standard commandbar that runs a little macro to paste as plain text, without any formatting.

    <font face="Georgia">Sub PasteAsPlainText()
    If Documents.Count > 0 Then 'To prevent an error if no document opened.
    Selection.PasteSpecial DataType:=wdPasteText
    End If
    End Sub</font face=georgia>

  4. #4
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (2002)

    Forgot to add the best: I assigned Alt+V to that macro. So you can use either
    - Ctrl+V to paste text normally
    - Alt+V to paste text as plain text

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (200

    Hi Jan:
    I see you've changed the macro slightly since <post#=356958>post 356958</post#>. You had an error handler & error message. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Force pasted text to use document styles? (200

    Hi Phil,

    I need to just clear up a statement or two that you made in your post, sothat I can make sure I understand your advice!

    When you say "text that contains a paragraph mark", are you sying that when you select the text, you drag the mouse past the text to include the mark?
    and
    When you say "text that does not contain a paragraph mark", are you sying that when you select the text, you drag the mouse to the last character so the mark is not included?

    These variations affect how the text is pasted into a paragraph!
    Regards,
    Rudi

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (200

    Hi Rudi:
    Sorry I wasn't clear. Yes, when I say text that includes the paragraph mark, that means that the text that was copied includes the paragraph mark at the end of at least one paragraph. Text that doesn't include the paragraph mark would be when you copy something less than an entire paragraph mark (although it may include all the text of the paragraph).

    These variations do affect how the pasted text looks.
    Cheers,

  8. #8
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force pasted text to use document styles? (200

    Hi Phil,
    You're absolutely right about that post, but no, I didn't change it... <img src=/S/nope.gif border=0 alt=nope width=15 height=15>
    The earlier version with error handling was copied from my code and the version in this thread was directly typed in. I was on another PC, where my code is not available. But of course it's best to include error handling! <img src=/S/yep.gif border=0 alt=yep width=15 height=15>

Posting Permissions

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