How to run a macro in Word after paste?

China☆狼群 提交于 2019-12-11 13:43:26

问题


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.


回答1:


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.

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



来源:https://stackoverflow.com/questions/29126435/how-to-run-a-macro-in-word-after-paste

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!