S
Sammy
Hi,
I am creating a macro to put our document management system's document ID
number in the footer. The field comes in like this:
::Odma\Pcdocs\Name\2102921\1
I need it to look like this:
2102921.1
Not sure how to manipulate the entire line to eliminate what I don't want.
The rest of the macro works although I probably wouldn't win any awards for
the code. So far I have:
Dim i As Integer
For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
.PageSetup.DifferentFirstPageHeaderFooter = True
.Footers(wdHeaderFooterFirstPage).Range.Delete 'clears out existing footer
.Footers(wdHeaderFooterPrimary).Range.Delete
'puts ID in first page footer
ActiveWindow.ActivePane.View.SeekView = wdSeekFirstPageFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Caps \p ", PreserveFormatting:=True
'puts ID in primary footer
ActiveWindow.ActivePane.View.SeekView = wdSeekPrimaryFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Caps \p ", PreserveFormatting:=True
End With
Next i
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Can you help? I've tried a variety of things over the past few weeks and
tried to figure this out myself, now I'm up against deadline pressure.
Thanks!
I am creating a macro to put our document management system's document ID
number in the footer. The field comes in like this:
::Odma\Pcdocs\Name\2102921\1
I need it to look like this:
2102921.1
Not sure how to manipulate the entire line to eliminate what I don't want.
The rest of the macro works although I probably wouldn't win any awards for
the code. So far I have:
Dim i As Integer
For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
.PageSetup.DifferentFirstPageHeaderFooter = True
.Footers(wdHeaderFooterFirstPage).Range.Delete 'clears out existing footer
.Footers(wdHeaderFooterPrimary).Range.Delete
'puts ID in first page footer
ActiveWindow.ActivePane.View.SeekView = wdSeekFirstPageFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Caps \p ", PreserveFormatting:=True
'puts ID in primary footer
ActiveWindow.ActivePane.View.SeekView = wdSeekPrimaryFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Caps \p ", PreserveFormatting:=True
End With
Next i
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Can you help? I've tried a variety of things over the past few weeks and
tried to figure this out myself, now I'm up against deadline pressure.
Thanks!