使用 VBA 编写 Word 的单一源文档

发布于 2024-08-20 06:55:41 字数 421 浏览 2 评论 0原文

有没有办法通过 VBA 或其他技术在 Word 中创建“单一源文档”。我的公司创建培训,并希望有一个“主文档”来容纳培训中的所有内容,然后据此创建交付方式和材料。例如,单个硕士课程将能够被查询以输出

  • 培训师工作簿、学生 工作簿和 PowerPoint 幻灯片(用于 讲师指导的示例 2天4次单独训练 主题)
  • 4 个独立的 PowerPoint 1 小时 会话(例如,对于远程 通过 WebEx 交付)。这将是一个 简化版课堂 当然和简化,即 定义什么内容 单一主Word文档。
  • 可以打印的工作辅助材料 以上两者。

因此,在上述所有三种情况下,完全相同的内容可能会出现在 1、2 或所有三种交付方式中。例如,在第二个模式中,可能只存在其他模式中不存在的两件事。

我的猜测是这将在 VBA 中完成,但我不太确定如何开始。

Is there a way to do a "Single Source Document" in Word via VBA or other techniques. My company creates training and wants to have a "master document" that hosts everything in the training and then from that, create the delivery modalities and materials. For example, a single master course would be able to be queries to output

  • A trainer workbook, a student
    workbook and PowerPoint slides (for
    example for an instructor-Led
    training of 2 days and 4 seperate
    topics)
  • 4 seperate PowerPoints for 1 hour
    sessions (for example, for remote
    delivery via WebEx). This would be a
    simplified version of the classroom
    course and that simplification, i.e.
    what content, would be defined within
    the single master Word document.
  • Job aids that could be printed for
    both of the above.

So in all three situations above, the exact same content may appear in 1, 2 or all three of the delivery modalities. In the 2nd one, maybe only 2 things exist there that are not in the other modalities, for example.

My guess is that this would be done in VBA, but I'm not really sure how to get started.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洒一地阳光 2024-08-27 06:55:41

单一源发布 (SSP) 有多种选项,这取决于什么您已经拥有以及您能够在新技术方面采取什么措施。对于 SSP,Word 不像其他一些工具那样强大,但近年来它已成为一个 可行的解决方案

  • 仅限 VBA

    如果您仅使用 VBA,则必须标记您的 Word 文档并创建模式来搜索并从中构建其他文档。例如,您可能有一个名为 %%%LESSON%%% 的令牌(通过该令牌您可以搜索 %%%*%%% 来了解您已经完成一课),然后在文本中您可能有 %%PPP/Class=True,PPT/Online=True,WRD/Student=False%% 来搜索并抓取只有您正在寻找的零件。因此,如果您使用上面的令牌创建学生手册,则该部分不会出现。

    就我个人而言,我不太喜欢这种方法,因为它很快就会变得笨拙。但它适用于任何 Word 和 PowerPoint 版本,并且不需要学习大量新技能或其他组件。

  • XSL 转换 (Word 2003)

    如果您的主要客户端是 Word 2003,则可以使用 XSL 转换。有大量关于此的文章,例如:应用XSLT 转换。这是一项非常酷的技术,使 Word 从 2003 版本开始成为 SSP 领域的竞争对手。请查看这篇文章:创建并应用Microsoft Office Word 2003 中的 XML 简历模板

    虽然这种方法确实更强大,但如果您不熟悉 XML/XSL/XPath,那么学习曲线会很陡。其次,生成 PowerPoint 幻灯片根本不容易 -(您可能需要转换为 PowerPoint 2003 ML)。

  • 内容控制和内容控制打开 XML (Word 和 PowerPoint 2007
    及以后)

    通过内容控制Open XML 您一定可以在 SSP 方面获得所需的内容。不过,有一个巨大的学习曲线,您必须采用一些外部工具(例如 Visual Studio,也许是 Open XML SDK 等)才能获得您想要的东西。

    就个人而言,这可能是我会采取的路线,但同样,从零到好的东西是相当陡峭的。

There are a wide variety of options available for single source publishing (SSP), it depends on what you've got and what you're able to take on in terms of new technologies. Word is not as robust for SSP as some other tools, but in recent years it has become a viable solution.

  • VBA Only:

    If you're using VBA only, you'll have to tokenize your Word document and create patterns to search through and build other documents out of those. For example, you could have a token that is called %%%LESSON%%% (by which you'd search for %%%*%%% to know you've reached a lesson) and then under that in the text you may have %%PPP/Class=True,PPT/Online=True,WRD/Student=False%% to also search on and grab only the parts you're looking for. So if you're creating a student manual with the token above, that section wouldn't appear.

    Personally, I'm not a big fan of this approach as it gets unweildy pretty quickly. But it works with any Word and PowerPoint version and doesn't require learning a lot of new skills or other components.

  • XSL Tranformation (Word 2003):

    If you're primary client is Word 2003, you could use XSL Transforms. There are tons of articles out there on this like: Applying an XSLT Transform. This is really cool technology and made Word, starting with version 2003, a bit of a competitor in the SSP space. Take a look at this article: Creating and Applying an XML Resume Template in Microsoft Office Word 2003.

    While this approach is certainly more robust, there's a steep learning curve if you're not familiar with XML/XSL/XPath. Secondarily, generating PowerPoint slides is not easy at all - (you could need to transform to the PowerPoint 2003 ML).

  • Content Controls & Open XML (Word and PowerPoint 2007
    and later)
    :

    Through a combination of Content Controls and Open XML you could definetely get what you you're looking for in terms of SSP. There is a huge learning curve though and you'll have to adopt some outside tools (like Visual Studio, maybe the Open XML SDK, etc.) to get what you want.

    Personally, this is probably the route I'd take, but again, it's pretty steep to go from zero to something good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文