【问题标题】:How do I dynamically fill Word Formfields using VBA如何使用 VBA 动态填充 Word 表单域
【发布时间】:2015-03-06 00:21:37
【问题描述】:

我是 VBA 新手,我找不到解决问题的方法。我使用带有下拉菜单的 Word 表单。此下拉菜单中的选项是名称。当我在下拉菜单中选择名称时,我希望 Word 自动填写 3 个其他(常规)表单域(带有联系方式)。基本上,我想要这里解释的内容(见链接),但不使用 Microsoft Access:

http://www.techrepublic.com/blog/how-do-i/how-do-i-dynamically-fill-microsoft-word-fields-using-access-data/

【问题讨论】:

    标签: vba ms-word


    【解决方案1】:

    在学习 VBA 2 周后,解决方案似乎很简单。如果有人需要完成同样的事情,这就是它。随意使用!

    If ActiveDocument.*name of dropdown field* = "contact person 1" Then
        ActiveDocument.FormFields("formfield1").Result = "xxx"
        ActiveDocument.FormFields("formfield2").Result = "xxx"
        ActiveDocument.FormFields("formfield3").Result = "xxx"
    ElseIf ActiveDocument.*name of dropdown field* = "contact person 2" Then
        ActiveDocument.FormFields("formfield1").Result = "xxx"
        ActiveDocument.FormFields("formfield2").Result = "xxx"
        ActiveDocument.FormFields("formfield3").Result = "xxx"
    ElseIf ActiveDocument.*name of dropdown field* = "contact person 3" Then
    
    ...etc
    
    End If
    

    【讨论】:

      猜你喜欢
      • 2017-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-08
      相关资源
      最近更新 更多