Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Chapel Hill, North Carolina, USA
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA PasteSpecial Unformatted Text (2003)

    Is there a way to write a macro in VBA to paste special in unformatted text? I tried using the Macro Recorder, but the resulting VBA was

    Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
    wdInLine, DisplayAsIcon:=False

    which did not pick up the unformatted choice. (I want to assign this to a button to simplify a process which required pasting messages from email to Word.

    Thanks!

    Larry

  2. #2
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: VBA PasteSpecial Unformatted Text (2003)

    Maybe I'm confused, but I think DataType:=wdPasteText corresponds to the unformatted choice.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: VBA PasteSpecial Unformatted Text (2003)

    If you search this forum for wdPasteText you will find many examples of Macros that do exactly what you are asking for.

    StuartR

  4. #4
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Chapel Hill, North Carolina, USA
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA PasteSpecial Unformatted Text (2003)

    Thanks - Did so poking around and it appears that the paste mimics the format of the existing text in the file. I had text that was bold and underline in the file and when I used the macro, the pasted text was also bold and underlined (hence my confusion). When I used the macro in a new file, it provided the expected results. Learn something new every day.

    Thanks again

    Larry

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: VBA PasteSpecial Unformatted Text (2003)

    When you paste as text only, the inserted text takes the format used at the location of the cursor. If your cursor is sitting in a Heading 1 then the inserted text will be Heading 1, if it is sitting in bold and underlined text then the inserted text will have those attributes.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Chapel Hill, North Carolina, USA
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA PasteSpecial Unformatted Text (2003)

    Thanks - makes sense! Larry

Posting Permissions

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