我在使用 Access 2013 中的数据填充 Word 2013 表单时遇到问题。参考:
Visual Basic for application
MS Access 15 Office Library
Ole automation
MS Access 15 database engine object
MS Word 15 Object Library
MS ActiveX data object multi-dimensional library 2.8
我的代码是:
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = New Word.Application
With wordApp
.Visible = True
Set wordDoc = .Documents.Open("C:\Template\Document.dotx", , False)
With wordDoc
.FormFields("NR").result = Me!NR
NR - 是标准数字格式,例如 1500.00
如果我在 Document.docx 中输入 1500.00,我会得到 1500,00,但如果我输入 1500.80(点后的 00 除外),我会得到 15008,00。打印的值比输入的值大十倍。
在区域设置中,我设置了点分隔符,但在 Word 中我看到了昏迷(但在 Access 2010 中它有效)。