Is there a way to change the value of a checkbox in a Word 97 .dot from the VB6 code that references it?
I'm populating the .dot using bookmarks
and creating the reference to the Word object as follows ...
Set objWord = GetObject(,"Word.Application")
If objWord Is Nothing Then ' If true, Word is not running.
Set objWord = New Word.Application ' Create a new instance of the Word application.
If objWord Is Nothing Then ' If true, MS Word 8.0 is not installed.
MsgBox "MS Word is not installed on your computer."
End If
End If
'set template name
objWord.Documents.Add (App.Path & "\accinc.dot")
objWord.Selection.GoTo what:=wdGoToBookmark, Name:="mybookmark"
objWord.Selection.TypeText recordset!myField
need something like
objword.formfield("mycheckbox").value = vbchecked
but cannot find!
Thanks!
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim wrdSelection As Word.Selection
Private Sub cmdWordCheckBoxes_Click()
Dim StrToAdd As String
On Error GoTo Error_Handler
'let us know we are doing something
Screen.MousePointer = vbHourglass
' Create an instance of Word and make it visible
Set wrdApp = CreateObject("Word.Applica
wrdApp.Visible = True
' Add a new document
Set wrdDoc = wrdApp.Documents.Add
wrdDoc.Select
Set wrdSelection = wrdApp.Selection
Dim x As Integer
For x = 4 To 1 Step -1
' Create 4 check boxes and insert it into the document
With ActiveDocument.FormFields.
(Start:=0, End:=0), Type:=wdFieldFormCheckBox)
.Name = "Color" & x
.CheckBox.Value = True
End With
Next
'checking checkboxes with index values
ActiveDocument.FormFields(
ActiveDocument.FormFields(
ActiveDocument.FormFields(
ActiveDocument.FormFields(
'checking checkboxes with name values
ActiveDocument.FormFields(
ActiveDocument.FormFields(
ActiveDocument.FormFields(
ActiveDocument.FormFields(
' wrdDoc.SaveAs ("c:\Test.doc")
' wrdDoc.Close False
Exit Sub
Error_Handler:
Screen.MousePointer = vbDefault
MsgBox "Error: " & Err.Number & vbLf & vbLf & Err.Description, vbExclamation, "Mail Merge Error!"
End Sub