Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2008

Tip: Looking for answers? Try searching our database.

checkbox data to table - empty rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dylan - 31 Jan 2008 09:36 GMT
I want to put selected checkboxes' caption names and texbox values into a
table containing DocVariable Fields. The problem is, when an item isn't
selected, I end up with an empty row.

Is there a way to input the selected items in an order that overcomes having
empty rows in the document table?

Kind Regards
DDawson
Doug Robbins - Word MVP - 31 Jan 2008 10:29 GMT
Show us the code that you are using.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I want to put selected checkboxes' caption names and texbox values into a
> table containing DocVariable Fields. The problem is, when an item isn't
[quoted text clipped - 6 lines]
> Kind Regards
> DDawson
Dylan - 31 Jan 2008 13:02 GMT
Doug

I'm following your previous advice and I've created DocVariable fields
throughout my word doc. I had problems leaving thanks at the previous
message, so I now do -thank you.

The part I need help on consists of a series of checkboxes/textboxes as
follows:

Risk Register

[]    [description]
chk1  txt1
chk2  txt2
chk3  txt3
chk4  txt4

Outputs go to docVariable Opt10a - Opt10d respectively.

As I previously stated I would like to omit gaps between the docVariables in
a table along with having the opportunity of reducing whitespace in other
areas of the document, where their Fields remain empty.

I thought about having a single row and adding new rows (or returning) after
each non-blank item is added along with the next docVariable being added to
the next row (or line)?

I have a Sub Initialise() routine in the ThisDocument object which contains
various lines to reload data from the docVariables to the userform. And I
have an action on the form's Okay button, to update the values of the
docVariables, as follows:

Sub Initialise()

'Risks
If ThisDocument.Variables("Opt10a").Value = "" Then
frmMain.chk1.Value = False
frmMain.txt1.Value = ""
Else
frmMain.chk1.Value = True
frmMain.txt1.Value = ThisDocument.Variables("Opt10a").Value
End If

If ThisDocument.Variables("Opt10b").Value = "" Then
frmMain.chk2.Value = False
frmMain.txt2.Value = ""
Else
frmMain.chk2.Value = True
frmMain.txt2.Value = ThisDocument.Variables("Opt10b").Value
End If

If ThisDocument.Variables("Opt10c").Value = "" Then
frmMain.chk3.Value = False
frmMain.txt3.Value = ""
Else
frmMain.chk3.Value = True
frmMain.txt3.Value = ThisDocument.Variables("Opt10c").Value
End If

If ThisDocument.Variables("Opt10d").Value = "" Then
frmMain.chk4.Value = False
frmMain.txt4.Value = ""
Else
frmMain.chk4.Value = True
frmMain.txt4.Value = ThisDocument.Variables("Opt10d").Value
End If

'***********************************************************
Private Sub cmd1_Click()

'Risks
If frmMain.chk1.Value = True Then
ThisDocument.Variables("Opt10a").Value = frmMain.txt1.Value
End If
If frmMain.chk2.Value = True Then
ThisDocument.Variables("Opt10b").Value = frmMain.txt2.Value
End If
If frmMain.chk3.Value = True Then
ThisDocument.Variables("Opt10c").Value = frmMain.txt3.Value
End If
If frmMain.chk4.Value = True Then
ThisDocument.Variables("Opt10d").Value = frmMain.txt4.Value
End If

Kind regards
Dylan Dawson

> Show us the code that you are using.
>
[quoted text clipped - 8 lines]
> > Kind Regards
> > DDawson
Doug Robbins - Word MVP - 31 Jan 2008 19:44 GMT
You may need to do some "post processing":

Dim af As Field
With ActiveDocument
   For Each af In .Fields
       If af.Type = wdFieldDocVariable Then
           If af.Result.Text = "" Then
               If af.Result.Information(wdWithInTable) = True Then
                   af.Result.Rows(1).Delete
               End If
           End If
       End If
   Next af
End With

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Doug
>
[quoted text clipped - 100 lines]
>> > Kind Regards
>> > DDawson

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.