excel - Range.Style 因语言而异
问题描述
我刚刚做了一个宏,它根据英文版 Office 中的某些内容更改样式。
现在我打开了西班牙语版本,但它不起作用。
事实证明,.Style ="Bad"
现在是.Style ="Incorrecto"
等等。
如何设置适用于任何语言的样式?
有没有可以按索引处理的样式集合?
解决方案
If you are wanting to ensure consistency across multiple languages, you could add a custom style to the sheet. This custom style should not change based on the user's language.
With ActiveWorkbook.Styles.Add(Name:="Some_Name")
.Borders(xlTop).LineStyle = xlDouble
.Font.Bold = True
.Font.Name = "Calibri" 'This is any font name, but you might check that it is same across different user languages.
End With
Worksheets(1).Range("A25:A30").Style = "Some_Name"
This is a workaround, but once defined it should be just as easy to use. Best of luck!
推荐阅读
- java - HikariPool-1 - 在连接获取期间中断
- graphql - 如何重新获取 gatsby 构建的 graphql 数据?
- java - Jetty_run 错误 java.lang.TypeNotPresentException:类型 javax.annotation.meta.When 不存在
- security - 如何防止 setmetatable 被覆盖
- kubernetes - 当我尝试启动 minikube 时收到错误消息“运行时错误:索引超出范围 [0],长度为 0”
- python - 为什么我的 python 字典一直被覆盖
- windows - Docker 图像命令不返回所有图像
- sql - 如何仅使用 Oracle SQL 返回 2 个字符串之间的差异
- database-design - 为什么 facebook messenger 和 discord 使用数据库而不是排队系统来获取他们的消息?
- google-apps-script - 无法在清单文件中设置会议解决方案的密钥