gpt4 book ai didi

vba - 如何使用 VBA 从 Excel 中的单元格返回所有格式?

转载 作者:行者123 更新时间:2023-12-02 19:14:32 26 4
gpt4 key购买 nike

如何使用 VBA 返回 Excel 中单元格的所有格式信息。例如:

purple struck through text followed by regular green text

我需要知道哪些文本是紫色的,哪些文本是绿色的,哪些文本被删除了。 Range("B2").Value 仅返回纯文本。我也需要格式化。

最佳答案

您最好的选择可能是使用智能感知来探索您可用的所有值。您可以使用 .Color.Strikethrough.Bold 等完成下面的代码片段,并让它们立即打印 window 。 (如果当前没有显示,Ctrl+G 将显示立即窗口)

Sub test()
debug.Print Range("B1").Font 'finish this line with any of the IntelliSense options to learn things about the text
End Sub

您还可以查看 MDSN 网站上列出的 font object 的属性。

关于vba - 如何使用 VBA 从 Excel 中的单元格返回所有格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27693220/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com