#1
|
|||
|
|||
Custom ribbon button or shortcut for a specific function
Hello,
I find myself doing the following a very large number of times: 1) I Click a cell in excel, press Ctrl + C to copy the content, 2) Enter word, press Paste special -> paste link: -> Unformatted text. Is it possible to create either a ribbon button or a shortcut (would be ideal to have both) in MS word that will perform the second action with one click/shortcut? This will save me alot of time. |
#2
|
|||
|
|||
Below is a macro that pastes unformatted text.
Code:
Sub PasteUnformatted() ' ' PasteUnformatted Macro ' ' Selection.PasteAndFormat (wdFormatPlainText) End Sub Installing Macros You can attach a keyboard shortcut to this and a QAT button easily. Modifying the QAT and Ribbon in Microsoft Word |
#3
|
|||
|
|||
Ahh, The macro and shortcut part is very neat.
However the macro only copies the next, not the link that came with it. I tried to find solutions to what the macro command is for pasting unformatted text as a "paste link" not as paste without success. When i record the result is a macro that bugs. Any ideas what this would be? |
#4
|
|||
|
|||
Well, that is what you said you wanted.
The following will paste a hyperlink, but carries other formatting with it. Code:
Sub PasteHyperlink1() ' ' PasteHyperlink1 Macro ' ' Selection.PasteAndFormat (wdFormatOriginalFormatting) End Sub Code:
Sub PasteHyperlink2() ' ' PasteHyperlink2 Macro ' ' Selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis) End Sub Last edited by Charles Kenyon; 04-21-2015 at 08:38 PM. Reason: add second macro |
#5
|
|||
|
|||
What i was mainly after was a one-click button for:
2) Paste special -> paste link: -> Unformatted text -> Ok. All the three macros seems to copy the content from excel into word but the "Link" is not copied with the content, into MS word. When i manually press Paste special -> paste link: -> Unformatted text, i get the number from the excel sheet copied into Word and afterwards when i right click the it, i get the "Update Link" and "linked worksheet object" options indicating that the link from excel is there. When i use either of the macros (or any other macros i have found) they only paste the value of the cell i copied and not the link. |
#6
|
|||
|
|||
Code:
Sub PasteAsLink() ' ' PasteAsLink Macro ' ' Selection.PasteExcelTable True, False, False End Sub |
#7
|
|||
|
|||
What it took for each of these was to record a simple macro that did what I thought you wanted.
The macro should be stored in a template, probably a different template than normal.dotm. The QAT button should be stored in the same template as the one holding the macro. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pass Arguments to Function Through Ribbon | inagalaxyfarfarawry | Word VBA | 11 | 03-25-2022 09:28 PM |
Shortcut Key - Ribbon Alt+H | RajaGa | Word | 3 | 04-17-2015 10:11 AM |
Is it possible to add a custom macro button to the FILE tab of the ribbon in excel | sbapabck | Excel | 2 | 04-11-2014 07:36 AM |
How to make a SPECIFIC FONT shortcut button? | E922 | Word | 4 | 03-18-2014 03:11 PM |
Ribbon button - showLabel attribute ignored | yiannis.spyridakis | Excel Programming | 2 | 06-12-2012 11:21 PM |