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 / Mailmerge and Fax / May 2004

Tip: Looking for answers? Try searching our database.

ODMA Doc ID Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julie - 04 May 2004 03:25 GMT
Hi - I am using Word 03 with DocsOpen which is a document
management system.  I have created a macro that puts the
document number in the footer of the document using the
ODMA Doc ID field found under Insert, Field,
DocProperties.  The macro cleans up the Doc Id so it just
displays the doc number and version number:

Like this:  587298.1
Instead of : ODMA::blablabla/587298.1

Works great, except when I print, the ODMA junk comes
back.  I do not have my fields updating when I print
(under tools, options).  

I tried to recreate the macro so it cuts the number and
then does a paste special unformatted so it wouldn't be a
field anymore, but the macro code doesn't work.

Can anybody help??  Thanks!
Peter Jamieson - 04 May 2004 09:37 GMT
Suggestions:
a. lock the field, e.g. add

yourfieldobject.Locked = True

(could be Selection.Fields.Locked = True)
after you have modified the field result. You may need to unlock it before
modifying it. Or..
b. create your own Custom Document Property and put your derived value in
there, then use a { DOCPROPERTY myproperty } field to insert it. Or use a
document variable and a { DOCVARIABLE } field. Or..
c. post the existing macro code here and perhaps we can suggest a tweak.

Signature

Peter Jamieson

> Hi - I am using Word 03 with DocsOpen which is a document
> management system.  I have created a macro that puts the
[quoted text clipped - 15 lines]
>
> Can anybody help??  Thanks!
Julie - 04 May 2004 18:17 GMT
Thanks Peter, I appreciate it.  YES I want to lock the
field after it's been formatted.  I put a new statement to
test it with the Filename field, my original statement for
the ODMA field is in as a comment for now.  Can't quite
figure out where to put the locked statement.

Here's my code:

Sub StampInFooter()

'
' FileStamp Macro
' Macro recorded February 16, 2004 by
'
   If Documents.Count = 0 Then Exit Sub
   
   
 ' Numinftr Macro
' Macro recorded 4/22/2004 by jstein
'
   If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
       ActiveWindow.Panes(2).Close
   End If
   If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
       ActivePane.View.Type = wdOutlineView Then
       ActiveWindow.ActivePane.View.Type = wdPrintView
   End If
   ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
   ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument

   If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
       ActiveWindow.Panes(2).Close
   End If
   If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
       ActivePane.View.Type = wdOutlineView Then
       ActiveWindow.ActivePane.View.Type = wdPrintView
   End If
   ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
   If Selection.HeaderFooter.IsHeader = True Then
       ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
   Else
       ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
   End If
 
   
   With ActiveDocument.PageSetup
       .DifferentFirstPageHeaderFooter = False
   End With
   Selection.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty, Text:= _
       "FILENAME  \* Caps \p ", PreserveFormatting:=True
   
   'Selection.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty, Text:= _
    '   "DOCPROPERTY  ODMADocId ",
PreserveFormatting:=True
       
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = "\"
       .Replacement.Text = "."
       .Forward = False
       .Wrap = wdFindAsk
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   With Selection
       If .Find.Forward = True Then
           .Collapse Direction:=wdCollapseStart
       Else
           .Collapse Direction:=wdCollapseEnd
       End If
       .Find.Execute Replace:=wdReplaceOne
       If .Find.Forward = True Then
           .Collapse Direction:=wdCollapseEnd
       Else
           .Collapse Direction:=wdCollapseStart
       End If
       .Find.Execute
   End With
   Selection.MoveRight Unit:=wdCharacter, Count:=1
   Selection.Extend
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = ":"
       .Replacement.Text = "."
       .Forward = False
       .Wrap = wdFindAsk
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.TypeBackspace
   
   Selection.EndKey Unit:=wdLine, Extend:=wdExtend
   With Selection.Font
       .Name = "Times New Roman"
       .Size = 8
       .Bold = False
       .Italic = False
       .Underline = wdUnderlineNone
       .UnderlineColor = wdColorAutomatic
       .StrikeThrough = False
       .DoubleStrikeThrough = False
       .Outline = False
       .Emboss = False
       .Shadow = False
       .Hidden = False
       .SmallCaps = False
       .AllCaps = False
       .Color = wdColorAutomatic
       .Engrave = False
       .Superscript = False
       .Subscript = False
       .Spacing = 0
       .Scaling = 100
       .Position = 0
       .Kerning = 0
       .Animation = wdAnimationNone
   End With
       
       Selection.Fields.Locked = True

   With ActiveDocument.PageSetup
       .DifferentFirstPageHeaderFooter = True
   End With
With Selection.Find
       .Forward = True
       
   End With
   
   
   ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
End Sub

-----------------------------

Sorry so long, and thanks for the help.

Julie

>-----Original Message-----
>Suggestions:
[quoted text clipped - 31 lines]
>
>.
Peter Jamieson - 04 May 2004 19:28 GMT
OK, you have

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME  \* Caps \p ", PreserveFormatting:=True

and after that, commented out, you have

'Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
'   "DOCPROPERTY  ODMADocId ", PreserveFormatting:=True

From what you have said, maybe the DOCPROPERTY field insertion should not be
commented out. Either way, try adding the following statement afterwards:

Selection.Fields.Locked = True

Signature

Peter Jamieson

> Thanks Peter, I appreciate it.  YES I want to lock the
> field after it's been formatted.  I put a new statement to
[quoted text clipped - 198 lines]
> >
> >.
 
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.