SAT – Updated after series of comments from Chuck =>: Now you can start shaving precious seconds, when you copy formatted text from outside sources into your Word or Excel documents. To assigns a keyboard shortcut to a macro in Excel, use this four steps: 01 Press Alt+F8 to open Macros dialog box We are suggesting to use Shift+Ctrl+V combination for this macro. And this macro should handle both scenarios. One is Copy and Paste Special inside Excel, and the other is Copy and Paste Text from outside the Excel. The problem here is that that there are two possible scenarios. 'Error will be caught, if there is nothing to pasteĪs you can see in Excel, it is a little more work. Selection.PasteSpecial Paste:=xlPasteValues If Application.ClipboardFormats(1) -1 Then In Excel open visual basic (Alt+F11) and paste this code into one of the PERSONAL.XLS modules: To map your new macro to a keyboard combination in Word 2007 do these simple 10 (Ten!) steps: 01 Click Office ButtonĠ5 Pick Macros in Categories drop-down listĠ6 Select your new macro in Macros drop down listĠ7 Position your cursor into Press new shortcut key I recommend to map this macro to Alt+V key combination. Who can suggest a better way of doing this without using dreaded “ GoTo” statements? It works multiple times, so you can paste the same string over and over again. It works in all Word versions, including Office 2010. First statement (Selection.PasteSpecial) handles rich text formats, and second statement (Selection.PasteAndFormat) deals with pasting Unicode strings. This macro was tested with Word 2007, and it can handle paste from Web and from Visuals Studio. Selection.PasteAndFormat (wdFormatPlainText) Placement:=wdInLine, DisplayAsIcon:=False Selection.PasteSpecial Link:=False, DataType:=wdPasteText, _ As of WED, I adopted this little macro as final version: Sub PasteText() Over the course of the day this is a huge inefficiency. Normally, you would do this with Paste Special, but this is several awkward clicks and many seconds lost.
0 Comments
Leave a Reply. |