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!
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.
--
Peter Jamieson
"Julie" <anon...@discussions.microsoft.com> wrote in message
news:7b9501c4317f$22bf3360$a401...@phx.gbl...
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
>.
>
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
--
Peter Jamieson
"Julie" <anon...@discussions.microsoft.com> wrote in message
news:814b01c431fb$af390b00$a401...@phx.gbl...