部署具有格式样式的Dotm文件? [英] Deploy Dotm File with format styles?

查看:94
本文介绍了部署具有格式样式的Dotm文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Word 2007/2010开发了一个小的VBA宏,它使用了一些格式样式(我不确定这是最好的翻译,在我的德语版本中称为Formatvorlagen.我的意思是适用于文本的样式,像标题).

I have developed a small VBA macro for Word 2007 / 2010 which uses some format styles (I am not sure that is the best translation, in my german version it is called Formatvorlagen. I mean the styles which are applied to text, like headers).

该宏已部署到STARTUP文件夹中,并且基本上可以工作-但未加载格式样式-因此该宏无法找到它们.

The macro is deployed to the STARTUP Folder and essentially works - but the format styles are NOT loaded - so the macro cannot find them.

所以我的问题是:如何将格式样式部署到Word?我可以覆盖normal.dot,但这是一个糟糕的解决方案.

So my question is: how can I deploy format styles to Word? I could overwrite normal.dot, but that is a crappy solution.

推荐答案

目前我可能没有想到一种更简单的方法,但是您可以尝试以下方法:

There's probably an easier way that I cannot think of at the moment, but you could try the following:

通过点击主页选项卡上的更改样式按钮,选择样式集另存为样式,导出所需样式.设置.

Export the styles you want by clicking the Change Styles button on the Home tab, selecting Style Set and Save as Style Set.

该命令会将当前选择的样式集另存为dotx文件.默认位置为C:\Users\[USERNAME]\AppData\Roaming\Microsoft\QuickStyles-如果将文件复制到新计算机上并将其放置在用户的同一目录中,则可以使用 Change Styles (更改样式)按钮或代码来加载样式集. :

The command will save the currently selected style set as a dotx file. The default location is C:\Users\[USERNAME]\AppData\Roaming\Microsoft\QuickStyles - if you copy the file to a new computer and put it in the same directory for the user, you can then load the style set with the Change Styles button or in code:

ActiveDocument.ApplyQuickStyleSet2 "XXX"

其中XXX是在 Change Styles (更改样式)按钮下看到的样式名称(与不带dotx扩展名的样式文件名相同).

where XXX is the name of the style as seen under the Change Styles button (the same as the styles filename without the dotx extension).

这篇关于部署具有格式样式的Dotm文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆