当文本存储在字符串中时,删除了上标的格式
Dim ST As String
ST = ActiveDocument.Paragraphs(1).Range.Text
在我的文档中,段(1)
实际上是 2 + 3 2 。但是,使用 debug.print st
,输出为 2 + 32 。有什么办法可以存储数据而不损害上标和下标?
其背后的目的是将5行存储在 st(1至5)
中,然后洗牌5行的顺序。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1-尚不清楚您要如何捕获段落,因此我假设您将选择这些段落,请根据您的要求进行修改
2-还不清楚什么 shuffle 意思是这样,我会假设您希望它被逆转,您需要以自己的逻辑来掌握有关如何进行 shuffle 段落的逻辑:
属性可用于用格式化的文本替换范围
com/en-us/office/vba/api/word.range.range.formattedText“ rel =” nofollow noreferrer“ > 需要首先选择段落,然后运行
sub
,它将在文档末尾复制所选段落,但按反向顺序重复。1 - It is not clear how do you want to capture the paragraphs so I'm assuming that you will have those paragraphs selected, modify it based on your requirement
2 - It is also not clear on what shuffle means so I will assume that you want it to be reversed, you will need to come out with your own logic on how to shuffle the paragraphs:
FormattedText property can be used to replace a range with formatted text so this should work for you:
You will need to select the paragraphs first then run the
Sub
, it will duplicate the selected paragraphs at the end of the document but in the reverse order.