Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Sonoma County, California, US of A
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cut/copy and remove formatting/style (97 SR-2)

    Lots of ideas on pasting unformatted text recently. My question- Is it possible to remove any local formatting and change the style to normal (or some other choice) when you cut or copy text from a word doc and send it to the clipboard? I'd like to be able to paste unformatted text into another application that doesn't offer a paste unformatted option. Right now I am running the text through a third app or another doc along the way to turn it into plain text.

    Thanks, Dave

  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: cut/copy and remove formatting/style (97 SR-2)

    Hi Dave:

    After you select the item to be cut:
    1. Press Ctrl+Spacebar to remove all direct character formatting.
    2. Press Ctrl+Q to remove all direct paragraph formatting.
    3. Press Ctrl+Shift+N to apply the normal style.

    Then you can cut & paste without applying additional styles or formatting to your target document. You could record this as a macro, if you do it often.

    Hope this helps.

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

    Re: cut/copy and remove formatting/style (97 SR-2)

    Dave,

    If you don't mind messing around in the VB Editor, another option is to use a macro which will put the text in unformatted form, directly into the clipboard, using something called the DataObject.

    Andrew Cronnolly once posted a link to <A target="_blank" HREF=http://www.cpearson.com/excel/clipboar.htm>this page from Chip Pearson's excellent website</A> - I've adapted this code from his:

    Note: this requires that a reference be set in the code project to the Microsoft Forms 2.0 object library - a shortcut trick for doing this is to insert a userform into the code project, and then remove the userform - the reference to the forms library will remain.

    <pre>Public Sub PutUnformattedTextInClipboard()
    'Based on code by Chip Pearson
    'See: http://www.cpearson.com/excel/clipboar.htm
    'Note: requires a reference be set to
    'Microsoft Forms 2.0 object library
    Dim strText As String
    Dim MyDataObj As New DataObject

    strText = Selection.Range.Text
    MyDataObj.SetText strText
    MyDataObj.PutInClipboard

    Set MyDataObj = Nothing
    End Sub
    </pre>

    Also note that this code substitutes for the Copy command. If you also wanted to delete the selected text (as in Cut), you'd need to press Backspace or Delete, after running this macro. It would be possible to have two macros like this, one for unformatted copy and one for unformatted cut, but I've left it this way for simplicity's sake.

    Gary

  4. #4
    Star Lounger
    Join Date
    Jan 2001
    Location
    Sonoma County, California, US of A
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: cut/copy and remove formatting/style (97 SR-2)

    Thanks Phil and Gary!

    Good thinking, looks like both these solutions will work for me. I figured there'd be a VBA way to do it, if I cant figure out the userform part, I'll post back. Phil's idea seems obvious now, but isn't that always the case with hindsight? I'll try them both out.

    Kudos, Dave Parker

Posting Permissions

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