[英]How can I determine the page number of a field in MS Word with VBA?
I am using the QR-Code DISPLAYBARCODE field.我正在使用二维码 DISPLAYBARCODE 字段。 I am updating all DISPLAYBARCODE with some information like date and time, additionaly I want to add the page number on which the DISPLAYBARCODE field is.
我正在使用日期和时间等信息更新所有 DISPLAYBARCODE,另外我想添加 DISPLAYBARCODE 字段所在的页码。
For tables I would use the range field but this is not available for fields.对于表格,我会使用范围字段,但这不适用于字段。
Is there a way how to do that?有办法吗?
If you want the page number to display as part of the QR Code, you could embed a page field in the text of the code.如果您希望页码显示为 QR 码的一部分,您可以在代码文本中嵌入页码字段。 Something like:
就像是:
Note the quotation marks.注意引号。 They are necessary.
他们是必要的。
The DATE and TIME fields are the date and time when the document is printed or those fields are updated. DATE 和 TIME 字段是打印文档或更新这些字段的日期和时间。 They are not fixed timestamps.
它们不是固定的时间戳。
I am working on the code for you to enter a field like the one shown.我正在为您编写代码以输入如图所示的字段。
Take a look at the second answer in this thread (from WillWillPower): Setting up a nested field in Word using VBA查看此线程中的第二个答案(来自 WillWillPower): Setting up a nested field in Word using VBA
It uses the range of the field code.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.