Solsiden
Solsiden

Reputation: 784

How to run a macro in Word after paste?

How do I make Microsoft Word to run a macro every time every time the user paste text?

I have recorded this macro:

Sub AdjustFontSize()
'
' AdjustFontSize Macro
' Adjusts font size
'
    Selection.WholeStory
    Selection.Font.Size = 24
End Sub

This changes the font size of everything in the document, and I want that to happen when the user is pasting text.

Upvotes: 3

Views: 1395

Answers (1)

Pankaj Jaju
Pankaj Jaju

Reputation: 5471

Try this code.

Sub EditPaste()
    Selection.Paste
    Selection.WholeStory
    Selection.Font.Size = 24
End Sub

EditPaste is an in-built command. You can find it here.

enter image description here

enter image description here

What I did is to overwrite the existing command and added my code into it.

Upvotes: 7

Related Questions