View Single Post
  #5   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Forumla for converting dates into days

If you were using formfields as in a protected document, you could use a
modification of 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

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.Table s(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.Form Fields(1).ExitMacro =
"addrow"

ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
1).Range.FormFields(1).Select

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True



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

"trinity" wrote in message
...

Is there a way to get this added to a new row automatically when the new
row is created (eg by pressing tab at the end of the last row)?

macropod Wrote:
Hi Jim,

Simply bookmark the date (not the cell!) in column B, then use a ref
field
in Column C to extract the date. For example:
If the date in B1 is August 12, 2005, and you bookmark this as
'B1Date',
then you'd use a REF field in C1 coded as:
{REF B1Date \@ dddd}. This should return 'Friday', not 'Monday' as
indicated
in your post ...

Cheers
PS: The field braces (i.e. '{}') are created in pairs via Ctrl-F9.
Alternatively, you can create the REF field via Insert|Field.


"Jim" wrote in message
...
I have a table in a works document. In columnn 1, I have topics, in
column 2
is the date (ie August 12, 2005), column 3, is to show the day of
the
week
(ie Monday)

PLease help!!!!!



--
trinity