-1

我在使用 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 中它有效)。

4

1 回答 1

0

我发现了一个错误!访问 VBA 代码没问题,但 Document.dotx 的内容有问题。我在帖子中写道,我在区域设置中设置了点分隔符,但在 Word 书签“NR”中我看到了昏迷。那是个问题。我更改了书签属性(数字格式从 0,00 到 0.00),一切都很好。很抱歉,我回答了自己的问题,但我希望这可以帮助其他人找到解决问题的方法。

于 2015-09-16T10:46:38.243 回答