Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
I wasn't sure whether this query counted as a table query or a VB
query, so have posted here first. Using Word 97, I have a word table, that is set to protected (Forms). In the table there are, amongst others, 2 columns of dates and a third column which I need to calculate the difference between the dates in the other two columns. I have defined the date columns with a Type of Date, both have bookmark names ITarg1 ...n and CTarg1 ...n the third column is has a Type of Number, a bookmark of MSDD1 ...n and a format of +#,##0 On exit from the CTarg column I run a macro (DD_MSDD1 ...n) to calculate the difference and put the result in the third column. Sub DD_MSDD1() MilestoneDateDiff "1" 'call to common routine to calc diff for MSDD1 End Sub Sub MilestoneDateDiff(DD) Initial = DateValue(ActiveDocument.FormFields("ITarg" & DD).Result) Current = DateValue(ActiveDocument.FormFields("CTarg" & DD).Result) days = Format(Current - Initial, ("+#,##0 ;-#,##0")) ActiveDocument.Unprotect ActiveDocument.FormFields("MSDD" & DD).Result = days ActiveDocument.Protect wdAllowOnlyFormFields, True End Sub What I need to achieve is the difference figure in the third column to display either as +ddd or -ddd, so far all I can achieve is ddd or -ddd. I have tried various formats, both within the vb and the cell format to no avail, ending up with, "(+14)" when there is a negative difference, (go figure !) or "+28" when there is a positive difference when I had set the MSDD1 cell with a format of +#,##0;(-#,##0) I would also like to introduce some degree of checking that there are values in both ITarg and CTarg cells, if at all possible. Can anyone help me out with this problem please ? Thanks and regards Fred |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
mail merging formatted content | Mailmerge | |||
Table Format Style vs. Table Text Style | Page Layout | |||
Document Styles should be assignable to fonts in Table AutoFormat | Tables | |||
Text form field inside WORD table cell, odd selection behavior | Microsoft Word Help | |||
Table headers/footers and layout | Page Layout |