Template Population

P

Peter S

I have a template that I customized with TextBox and CheckBox controls
created from the Control Toolbox toolbar. I use the following code to
automate word within VB6:

Set appWord = New Word.Application
Set doc = appWord.Documents.Open("C:\AuditDB\KPI\ACC_Form.dot")

MS Word version is 9.0 (2000)

The issue I am having is how do I reference the TextBox and CheckBox
objects to populate the data programmatically within VB6 code without
the user actually entering data into an ms word document.

I tried recording a macro while I open the template, but it seems that
none of my entries into the objects get recorded and therefore I can't
see how that vba in word translates the population of these objects.

I am an experienced SQL/VB/VBA programmer however I have not done ms
word automation for almost ten years and I have done it in the past,
but do not have the actual examples how I did it.

I hope my explanation is clear. Please let me know if there is a way I
can do this from VB6 without the user actually entering data into the
word template. It's like I want to treat ms word as report output of
information residing on a VB6 form that was queried from SQL Server.

Thx,
Peter
 
J

Julian Turner

I have a template that I customized with TextBox and CheckBox controls
created from the Control Toolbox toolbar. I use the following code to
automate word within VB6:

Set appWord = New Word.Application
Set doc = appWord.Documents.Open("C:\AuditDB\KPI\ACC_Form.dot")

MS Word version is 9.0 (2000)

The issue I am having is how do I reference the TextBox and CheckBox
objects to populate the data programmatically within VB6 code without
the user actually entering data into an ms word document.

I tried recording a macro while I open the template, but it seems that
none of my entries into the objects get recorded and therefore I can't
see how that vba in word translates the population of these objects.

I am an experienced SQL/VB/VBA programmer however I have not done ms
word automation for almost ten years and I have done it in the past,
but do not have the actual examples how I did it.

I hope my explanation is clear. Please let me know if there is a way I
can do this from VB6 without the user actually entering data into the
word template. It's like I want to treat ms word as report output of
information residing on a VB6 form that was queried from SQL Server.

Thx,
Peter

Hi

I am a bit of an amateur myself, but I know that if I add say a
CheckBox ActiveX control to a word document, then:-

(a) In "Design Mode" I right click on it to bring up the
properties, and give it a name (e.g. CheckBox1). I then switch off
"Design Mode" to activate it.

(b) I can then access the CheckBox as
"ActiveDocument.CheckBox1.Value = False" or "Application.Documents
(1).CheckBox1.Value = False"

(c) Or I can then access the CheckBox as
"ActiveDocument.InlineShapes(1).OLEFormat.Object.Value = False"

Regards

Julian Turner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top