Button or Click Event to Expand - Show Table Column Cell or Sectio

J

JBark

Hi, I am hoping someone can point me in the right direction. I would like to
create a button or click "on Something" event so that a user can make a
choice to display, expand or show more sections, tables, cells or columns on
a form. I have seen some other posts about this. In fact, I did come across a
post somewhere (maybe not in this forum) but lost track of it and I can not
find it again. It was basically click "something" and it revealed a 2nd
column in a table.

Basically I am looking for the user to be able to control how many
additional sections they need to fill out on the form. For instance, let's
say the user needs to fill in their address on the form but they have a
second address also like a PO Box or a 2nd home in the Bahamas (I'd like one
of those!) I would like to have 3 sections titled Address #1, Address #2 and
Address #3. Address #1 is a given and will always be showing, but I would
like to have Address #2 and Address #3 just as a header until the user clicks
on it to display the rest of the table so it can be filled in.

I DO NOT want to use Outline view. I've seen other posts about that. I am
also limited at this point to the programming being compatible with Word 2003
and 2007 and possibly even with it being created in Word for Mac 2004. The
completed form will also need to be emailed with the filled in information
left in tact by using the Send To Recipient as HTML format option.

Tall Order! I know! but any help in direction is greatly appreciated. Thanks.
 
D

Doug Robbins - Word MVP

You could use something like the following:

Sub addrow()
'
' Macro created 02/02/03 by Doug Robbins
' To add a new row to a table containing formfields in every column
' automatically on exit from the last cell in the present last row of the
table
Dim rownum As Integer, i As Integer
If MsgBox("Do you need to add another address", vbQuestion + vbYesNo,
"Additional Address") = vbYes Then
ActiveDocument.Unprotect
ActiveDocument.Tables(1).Rows.Add
rownum = ActiveDocument.Tables(1).Rows.Count
For i = 1 To ActiveDocument.Tables(1).Columns.Count
ActiveDocument.FormFields.Add
Range:=ActiveDocument.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput
Next i
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.FormFields(1).ExitMacro =
"addrow"
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
1).Range.FormFields(1).Select
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub


--
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, originally posted via msnews.microsoft.com
 
J

JBark

Doug,
Thanks so much for your input. Does this programming expand or show rows in
a table which have already been formatted with some text and fields? Or does
it just add "blank" rows to a table? Thanks.
 
D

Doug Robbins - Word MVP

It adds a new row to the table with the cells in that row containing
formfields into which the user can enter the required information, so not
exactly a "blank" row.

--
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, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top