Try this
Sub FormatFreeTextCopy()
Dim ffText As DataObject
Set ffText = New DataObject
ffText.setText Selection.Text
ffText.PutInClipboard
End Sub
Note: You would have to Reference to Microsoft Forms Object Library
Вопрос
When I copy a text from Microsoft Word and the text is a heading in the clipboard I see it included a paragraph number. Then in another application I must remove the number manually. Can I copy just a text without any additional information? (The same is with Chrome when you copy a URL it adds a http:// automatically)
Решение 2
Try this
Sub FormatFreeTextCopy()
Dim ffText As DataObject
Set ffText = New DataObject
ffText.setText Selection.Text
ffText.PutInClipboard
End Sub
Note: You would have to Reference to Microsoft Forms Object Library
Другие советы
Method 1:-
one way is right mouse click and use this paste special option
Method 2:- assign a shortcut(Ctrl+Shift+V) for this operation (Note: by default Ms word not set shortcut for it so we need to set it by own)
File
> Options
> Customize Ribbon
> Keyboard shortcuts: Customize.
Categories
List section, click on All Commands
Commands
List, select for PasteTextOnly
PasteTextOnly
as Ctrl+Shift+VMethod 3 permanent/Default Settings
use this option which will each time paste as plain text by default
There is a generic "paste plain text" solution using autohotkey open-source automation software:
^+v:: ; Text–only paste from ClipBoard
Clip0 = %ClipBoardAll%
ClipBoard = %ClipBoard% ; Convert to text
Send ^v ; For best compatibility: SendPlay
Sleep 50 ; Don't change clipboard while it is pasted! (Sleep > 0)
ClipBoard = %Clip0% ; Restore original ClipBoard
VarSetCapacity(Clip0, 0) ; Free memory
Return
paste_plain_text.ahk
scriptIt will paste plain text using Ctrl+Shift+V
shortcut. You can put your script at Startup directory so it loads on Windows startup.