粘贴后如何在Word中运行宏? [英] How to run a macro in Word after paste?

查看:194
本文介绍了粘贴后如何在Word中运行宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次用户粘贴文本时,如何使Microsoft Word每次运行宏?

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

我已经录制了这个宏:

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.

推荐答案

尝试以下代码.

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

EditPaste是内置命令.您可以在这里找到它.

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.

这篇关于粘贴后如何在Word中运行宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆