使用表单内容中的名称保存文件 [英] Save file with name from form content

查看:84
本文介绍了使用表单内容中的名称保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用特定文件名保存Microsoft Word 2013文档.

I'm trying to save a Microsoft Word 2013 document with a specific filename.

我创建了一个客户填写的Word表单.

I created a Word form that a client fills out.

我正在使用以下内容:DEVELOPER->控件->纯文本内容控件DEVELOPER->控件->日期选择器内容控件DEVELOPER->控件->下拉列表内容控件

I am using the following: DEVELOPER -> Controls -> Plain Text Content Control DEVELOPER -> Controls -> Date Picker Content Control DEVELOPER -> Controls -> Drop-Down List Content Control

我想要一个宏以表单中字段之一的名称保存文档.

I would like a macro to save the document with the name of one of the fields in the form.

示例:
下面是可填写的内容字段.

Example:
below are fillable content fields.

client reference: A1B2-345
date: August 17, 2015
type: metadata

我要将文件另存为:

A1B2-345_17082015_metadata.DOCX

推荐答案

请注意,如果您基于模板(.dotm)生成表单,则上面提供的代码将无法正常工作.包含ThisDocument.SelectContentControlsByTitle的以下行需要更改为 ActiveDocument.SelectContentControlsByTitle否则代码将从内容控件中提取占位符文本.

It should be noted that the code provided above will not work properly if you are generating the form based off a template (.dotm). The following lines that include the ThisDocument.SelectContentControlsByTitle need to be changed to ActiveDocument.SelectContentControlsByTitle otherwise the code will pull the place holder text from the content control.

这篇关于使用表单内容中的名称保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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