Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Macronumskull
 
Posts: n/a
Default can word automatically create a new row

I have a table in Word with 2 form fields in 1 cell, both form fields are
formatted for different colour and sized font.
I have used the addrow macro from Doug Robbins but this only adds a row with
1 form field in the cell.
Is it possible to adapt the macro so that it adds cells with 2 form fields
automatically?
  #2   Report Post  
Posted to microsoft.public.word.tables
Charles Kenyon
 
Posts: n/a
Default can word automatically create a new row

Yes.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"Macronumskull" wrote in message
...
I have a table in Word with 2 form fields in 1 cell, both form fields are
formatted for different colour and sized font.
I have used the addrow macro from Doug Robbins but this only adds a row
with
1 form field in the cell.
Is it possible to adapt the macro so that it adds cells with 2 form fields
automatically?



  #3   Report Post  
Posted to microsoft.public.word.tables
Greg Maxey
 
Posts: n/a
Default can word automatically create a new row

You might try:

Sub NewRow()
Dim pTable As Word.Table
Dim oRng1 As Word.Range
Dim oRng2 As Word.Range
Dim oRng3 As Word.Range
Dim oFormField As Word.FormField
Dim bCalcFlag As Boolean
Dim i As Long
If MsgBox("Do you want to create a new row?", vbQuestion + vbYesNo,
"Create New Row") = vbYes Then
ActiveDocument.Unprotect
bCalcFlag = False
Set pTable = Selection.Tables(1)
Set oRng1 = pTable.Rows(pTable.Rows.Count).Range
Set oRng3 = oRng1.Duplicate
With oRng1
.Copy
.Collapse Direction:=wdCollapseEnd
.Paste
End With
Set oRng2 = pTable.Rows(pTable.Rows.Count).Range
For i = 1 To oRng1.FormFields.Count
Set oFormField = oRng1.FormFields(i)
With oFormField
If .Type = wdFieldFormTextInput Then
If Not bCalcFlag And .TextInput.Type = 5 Then
bCalcFlag = True
MsgBox "You must edit expressions in any new calculation
fields."
End If
End If
End With
oRng2.FormFields(i).Select
With Dialogs(wdDialogFormFieldOptions)
.Name = oRng3.FormFields(i).Name & "_Copy_" & i
.Execute
End With
Next
If Not bCalcFlag Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End If
End Sub

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reveal codes in a word document FUN101 Microsoft Word Help 4 May 16th 23 08:47 PM
hard space between words. Sandy L Microsoft Word Help 7 May 5th 06 08:25 PM
Word should allow to 'divide' page by 3 or 4, not just 2 CandasK Page Layout 2 February 28th 06 10:16 PM
Converting Word Perfect forms to Word forms elyse Microsoft Word Help 1 February 15th 06 08:17 PM
Envelope Address GR New Users 5 April 24th 05 09:48 PM


All times are GMT +1. The time now is 04:17 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"