使用VBA将数据合并到ActiveX控件中 [英] Using VBA To Merge Data Into An ActiveX Control
问题描述
我有一个访问数据库,我用它来将数据合并到Word模板中。在Access应用程序中,我按下用VBA编码的按钮
打开Word模板
合并文本字段数据[字段在表格中]
使用新名称保存文档[另存为代码]
我需要将数据合并到的最后一个字段是ActiveXControl,但合并数据的VBA是不工作
如果我在Word中手动运行代码[在文档保存为代码之后]它合并得很好但我希望它与其他代码合并
这是Word中的代码
选择第二个表,第一行,第三列
复制数据
将该数据插入ActiveX控件中名为"Text"的属性中。
ActiveDocument.Tables(2).Cell(1,3)。选择
Selection.Copy
ActiveXControl1.Text =选择
任何想法如何使代码运行使用其他VBA代码访问?或者没有用户干预的解决方法?
Hi, I have an access database that I'm using to merge data into a Word template. In the Access app, I press a button coded with VBA
A Word template opens
Merges text field data [Word fields are in a table]
Saves the document with a new name [Save As code]
The last field I need to merge data into is an ActiveXControl but the VBA to merge the data is not working
If I run the code manually in Word [after the document save as code] it merges fine but I want it to merge with the other code
This is the code in Word
Selects the 2nd table, 1st row, 3rd column
Copies the data
Inserts that data into a property called "Text" in the ActiveX Control
ActiveDocument.Tables(2).Cell(1, 3).Select
Selection.Copy
ActiveXControl1.Text = Selection
Any idea how to make the code run in Access with the other VBA code? Or a workaround without having user intervention?
谢谢
推荐答案
可能:
ActiveXControl1.Object.Text =选择
ActiveXControl1.Object.Text = Selection
这篇关于使用VBA将数据合并到ActiveX控件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!