PDA

View Full Version : Export Yes/No Value to Word Checkbox



boneKrusher
04-08-2006, 03:29 PM
Does anyone know how to Export Yes/No Value to Word Checkbox? This is what I have so far.


Dim path As String
Dim objWord As Object
pathx = CurrentProject.path & "\file.dot"
Dim dtnow As String
DoCmd.SetWarnings False


Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible

'path and name of the template your are using.
objWord.Documents.Add (pathx)

If Me.FAA145 = -1 Then
objWord.ActiveDocument.Bookmarks("check1").Select
objWord.Selection.CheckBox = 1
End If

boneKrusher
04-11-2006, 05:39 AM
anyone? HELP!!!!

boneKrusher
04-11-2006, 06:36 AM
Solved it...took a little work but here it is





Dim path As String
Dim objWord As Object
pathx = CurrentProject.path & "\file.dot"
Dim dtnow As String
DoCmd.SetWarnings False


Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible

'path and name of the template your are using.
objWord.Documents.Add (pathx)

If Me.FAA145 = -1 Then
objWord.ActiveDocument.FormFields("Check1").CheckBox.Value = True
End If

Killian
04-11-2006, 06:47 AM
Well done...

I was trying to get this but didn't realise you were using formfields - I assumed a checkbox control, which is a little harder to get hold of, but just in case...Dim f As Field

For Each f In ActiveDocument.Fields
If f.OLEFormat.Object.Name = "CheckBox1" Then
f.OLEFormat.Object.Value = True
End If
Next f

boneKrusher
04-11-2006, 08:27 AM
whats the difference. I have no clue?

boneKrusher
04-11-2006, 09:37 AM
never mind...I got it. I am using the Checkbox from the FORMS toolbar......

Killian, thx for the help. Your always there!