By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

CreateObject("Word.Application")

P: n/a
Below is a section of the code I use to open Word with late binding, insert
text at the selected bookmarks, and make Word visible. Everything works
fine. However, I also have some Word check boxes, that I cannot figure out
how to make 'checked'. I am not allowed to alter the layout of the form; it
must be a check box. Up until now, I have simply required users to check
the box themselves, but now I'm opening up four Word forms that all have the
same check box - I really need to get this.

Anybody got a one-line solution?
Darryl Kerkeslager

-----------------------------------------------------------------
Dim mWord As Object
Set mWord = CreateObject("Word.Application")
mWord.Documents.Add oDocs & "odis_PPS_100_CaseClosing.dot"
With mWord.ActiveDocument
.Bookmarks("off_name").Range.Fields(1).Result.Text =
GetOffenderName()
.Bookmarks("district_id").Range.Fields(1).Result.T ext = "#" &
GetDistrictID()
.Bookmarks("Today").Range.Fields(1).Result.Text = Date
End With
mWord.Visible = True
Set mWord = Nothing
---------------------------------------------------------------------
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Does the following help?

http://groups.google.com/groups?hl=z....microsoft.com

Herbert

"Darryl Kerkeslager" <Ke*********@comcast.net> bl
news:vd********************@comcast.com g...
Below is a section of the code I use to open Word with late binding, insert text at the selected bookmarks, and make Word visible. Everything works
fine. However, I also have some Word check boxes, that I cannot figure out how to make 'checked'. I am not allowed to alter the layout of the form; it must be a check box. Up until now, I have simply required users to check
the box themselves, but now I'm opening up four Word forms that all have the same check box - I really need to get this.

Anybody got a one-line solution?
Darryl Kerkeslager

-----------------------------------------------------------------
Dim mWord As Object
Set mWord = CreateObject("Word.Application")
mWord.Documents.Add oDocs & "odis_PPS_100_CaseClosing.dot"
With mWord.ActiveDocument
.Bookmarks("off_name").Range.Fields(1).Result.Text =
GetOffenderName()
.Bookmarks("district_id").Range.Fields(1).Result.T ext = "#" &
GetDistrictID()
.Bookmarks("Today").Range.Fields(1).Result.Text = Date
End With
mWord.Visible = True
Set mWord = Nothing
---------------------------------------------------------------------

Nov 13 '05 #2

P: n/a
For checkboxes, I do this:
If Forms!frmForm!frmGroup = 1 Then
.ActiveDocument.Bookmarks("chkBox1").Select
.Selection.Text = "X"
End If
If Forms!frmForm!frmGroup = 2 Then
.ActiveDocument.Bookmarks("chkBox2").Select
.Selection.Text = "X"
End If

Et cetera. You don't get the square around the checkbox, but it
works.

I suggest using DocVariables instead of bookmarks if you have a lot of
things to bring over -- much faster. (No checkboxes, though.)
Below is a section of the code I use to open Word with late binding,

insert
text at the selected bookmarks, and make Word visible. Everything works
fine. However, I also have some Word check boxes, that I cannot figure

out
how to make 'checked'. I am not allowed to alter the layout of the form;

it
must be a check box. Up until now, I have simply required users to check
the box themselves, but now I'm opening up four Word forms that all have

the
same check box - I really need to get this.

Anybody got a one-line solution?
Darryl Kerkeslager

-----------------------------------------------------------------
Dim mWord As Object
Set mWord = CreateObject("Word.Application")
mWord.Documents.Add oDocs & "odis_PPS_100_CaseClosing.dot"
With mWord.ActiveDocument
.Bookmarks("off_name").Range.Fields(1).Result.Text =
GetOffenderName()
.Bookmarks("district_id").Range.Fields(1).Result.T ext = "#" &
GetDistrictID()
.Bookmarks("Today").Range.Fields(1).Result.Text = Date
End With
mWord.Visible = True
Set mWord = Nothing
---------------------------------------------------------------------

Nov 13 '05 #3

P: n/a
Yes, that did it. I think I tried something like that earlier, but it must
not have been *exactly* that.

Thanks.

Darryl Kerkeslager

"Herbert Chan" <he*****@chan.com> wrote:
Does the following help?

http://groups.google.com/groups?hl=z....microsoft.com
Nov 13 '05 #4

P: n/a
Thanks, but unfortunately, I had to use the checkBox. I could not alter the
form in any way.
Darryl Kerkeslager

"Nicole" <ni*****@namg.com> wrote:
:
:
Et cetera. You don't get the square around the checkbox, but it
works.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.