当前位置:网站首页>[word] word 2010 recording macro batch replacing paragraph marks in the selected text
[word] word 2010 recording macro batch replacing paragraph marks in the selected text
2022-06-12 06:13:00 【iShare_ one hundred and twenty-three】
List of articles
Word 2010 The replacement function is very powerful , Recently will PDF The text in the document copy To Word I found a lot of paragraph marks in it , Replacing one by one is very troublesome , So I want to record a macro , Sly lazy !
Record macro
Select the text content to be replaced , Click View >> macro >> Record macro >> Set up “ Macro name ”, determine , Start the recording process :"ctrl+H" Call out “ Replace ” Dialog box , stay “ Find content ” Input in “^p”, stay “ Replace with ” Leave blank in the middle , Click on “ All replacement ”, Jump out of “word Finished searching the selection , Whether to search the rest ”, choose “ no ”, Click on “ View >> macro >> Stop recording ”.
After recording , Of course, we have to test it . First select the text content to be replaced , Click Run macro , Open and close your eyes , Unexpectedly, the paragraph marks of the whole document have been replaced !
Why on earth ? From the perspective of performance, it is preliminarily estimated that something went wrong in the last step of the macro recording process .
Code correction
Open the editor to view the code :
With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
be aware .Wrap = wdFindAsk, Change it to .Wrap = wdFindStop, As shown below :
With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Reselect a piece of text , Run macro , perfect !!!
Summarize the reasons : Macro recording does not perfectly translate actions into code , So there is Bug. therefore , The safest way is to test it after recording , Don't start celebrating until you have done the right thing !
边栏推荐
- Unity vscode cannot jump to definition
- Houdini script vex learning
- Leetcode-1706. Where does the club fall
- IBL of directx11 advanced tutorial PBR (3)
- Using hidden Markov model to mark part of speech
- Sensor bringup 中的一些问题总结
- Analysis of memory management mechanism of (UE4 4.26) UE4 uobject
- In unity3d, billboard effect can be realized towards another target
- Unable to access this account. You may need to update your password or grant the account permission to synchronize to this device. Tencent corporate email
- JS variable scope
猜你喜欢

(UE4 4.27) customize globalshader

Performance optimization metrics and tools

Why don't databases use hash tables?

为什么数据库不使用二叉树、红黑树、B树、Hash表? 而是使用了B+树

dlib 人脸检测

数据库为什么不使用hash表?

为什么联合索引是最左匹配原则?

Sqlite Cross - compile Dynamic Library

Android studio mobile development creates a new database and obtains picture and text data from the database to display on the listview list

前台展示LED数字(计算器上数字类型)
随机推荐
C # converts the hexadecimal code form of text to text (ASCII)
EBook upload
Houdini & UE4 programmed generation of mountains and multi vegetation scattering points
How to split a row of data into multiple rows in Informix database
Redis queue
Pytorch implementation of regression model
Remap function of C different interval mapping
Summary of some problems in sensor bring up
Unity implements smooth interpolation
User login (medium)
Get the size of the picture
Leetcode-1663. Minimum string with given value
zip 和.items()区别
Poisson disk sampling for procedural placement
Sensor bringup 中的一些问题总结
Unity can realize the rotation, translation and scaling script of the camera around the target point on the mobile terminal device
How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]
A preliminary understanding of function
相机图像质量概述
Bert use