I have code that automatically detects certain text based on a selection and places onto a user form.
The issue I face is removing the trailing paragraph marker. (see picture below):
I have tried the following and other variations, but I can't remove the trailing paragraph marker:
Dim theText As String
theText = Replace(Selection, "^p", "")
Lastly, I know I can use Left(Selection,Len(Selection)-1)
, but this will fail if the paragraph marker is not there.
要在 Word 中获取段落,请使用以下 2 个选项之一(第一个适用于 OP):
theText = Replace(Selection, ChrW$(13), "")
theText = Replace(Selection, ChrW$(244), "")
As provided in the comments above this is the solution:
Dim theText As String
theText = Replace(Selection, Chr(13), "")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.