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 / July 2007

Tip: Looking for answers? Try searching our database.

Word table and formfields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VBA Neophyte - 26 Jul 2007 19:26 GMT
I have a table with rows containing some plain text and some formfields,
including a Yes checkbox.  I want to copy selected cells of selected rows of
the table either to the end of the existing doc or to another doc, but only
the rows where the Yes checkbox is checked.  Any suggestions?

Example: In this table, some rows (e.g. a high-level header) do not have the
Checkbox row; but if cell 3 of the row contains the Checkbox, then: cell 2 is
plain text, cell 3 is Yes CheckBox formfield, cell 4 is plain text, cell 5 is
an TextInput formfield.  If the Yes CheckBox in cell 3 = Yes, I want to copy
cells 2. 4 and 5 to a new table at the end of the document or into a new
table in a new separate document.
zkid - 27 Jul 2007 01:20 GMT
There are a couple of ways to go about this.  The easiest is to name the
checkboxes (do this through the bookmark field within the form field).  Then,
use this code to check it:

If ActiveDocument.FormFields("BookmarkNameHere").CheckBox.Value = True Then
  'code here to copy the desired cells.  Sorry, but it is unclear how you
are determining which cells to copy
End if

> I have a table with rows containing some plain text and some formfields,
> including a Yes checkbox.  I want to copy selected cells of selected rows of
[quoted text clipped - 7 lines]
> cells 2. 4 and 5 to a new table at the end of the document or into a new
> table in a new separate document.
VBA Neophyte - 27 Jul 2007 14:22 GMT
Thanks for your response.  Here's what I want to do:

If the CheckBox value in cell 3 = true,  I want to copy cells 2. 4 and 5 to
a new table at the end of the document or into a new table in a new separate
document.  Cells 2 and 4 are plain text in the table; cell 5 is a formfield.

I don't know how to do a copy statement for a range with some plain text
cells and a formfield cell.

Also, this is pretty repetitive, so I was looking for something that would
just step through the table without having to specifically refer to formfield
Bookmark name, e.g. using a counter index to do the following

Row(i) : if cell 3 contains a checkbox with value = Yes, copy contents of
cells 2, 4 and 5 to next line in new table.

> There are a couple of ways to go about this.  The easiest is to name the
> checkboxes (do this through the bookmark field within the form field).  Then,
[quoted text clipped - 16 lines]
> > cells 2. 4 and 5 to a new table at the end of the document or into a new
> > table in a new separate document.
zkid - 27 Jul 2007 18:22 GMT
Is the document protected for the formfields, or are you using ActiveX
controls?  

Is the table consistent (e.g., same number of rows and columns without any
cells merged or split in between)?

> Thanks for your response.  Here's what I want to do:
>
[quoted text clipped - 32 lines]
> > > cells 2. 4 and 5 to a new table at the end of the document or into a new
> > > table in a new separate document.
VBA Neophyte - 27 Jul 2007 21:26 GMT
The document is protected for the formfields.

The table, unfortunately, is not consistent.  It has some embedded merged
cells and some split cells.  I was wondering about handling these as separate
sections, then I could at least have a few different macros based on
format/section range.  If this makes sense.

> Is the document protected for the formfields, or are you using ActiveX
> controls?  
[quoted text clipped - 38 lines]
> > > > cells 2. 4 and 5 to a new table at the end of the document or into a new
> > > > table in a new separate document.
zkid - 27 Jul 2007 21:56 GMT
Okay, I was concerned about those items.  We have three issues here.  The
fact that the doc is protected means you will need to unprotect it in order
to add the new information to the end and then reprotect it.  Definitely you
would be better off creating an unprotected section in which to copy the data.

Second, if the table columns/rows are inconsistent, it is more difficult to
step through the table and determine and copy the correct cell's data.  

Third, I think you stated that some of the data to be copied is from
straight text and some of it resides in a form field.  Again, that means
unprotecting the doc and reprotecting it in order to copy straight text from
a cell.  If they are all formfields, then no unprotecting is necessary.

If there wasn't any straight text, naming the formfields would be the way to
go.   But, it appears you don't have that option here.

I need to think about this over the weekend when I have more time.  In the
meantime, I suggest you repost this in the VBA General Question community, as
this question is much more complex than the beginning VBA community can
handle.  For the subject line, title it something like Stepping through
protected table cells.

> The document is protected for the formfields.
>
[quoted text clipped - 45 lines]
> > > > > cells 2. 4 and 5 to a new table at the end of the document or into a new
> > > > > table in a new separate document.
VBA Neophyte - 30 Jul 2007 13:32 GMT
Will do, thanks very much.  This is a great resource.

> Okay, I was concerned about those items.  We have three issues here.  The
> fact that the doc is protected means you will need to unprotect it in order
[quoted text clipped - 67 lines]
> > > > > > cells 2. 4 and 5 to a new table at the end of the document or into a new
> > > > > > table in a new separate document.
 
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.