N
njmike
I've been reading through these Word groups for a couple months now,
and I've found plenty of information and answers to my problems - up
until now. I've spent a fair amount of time trying to find a solution
to this, but I've been coming up with nothing so far, which I find
somewhat embarrassing, as I've this seems like it should be rather
simple.
I update forms all the time - all of which have a version date in the
footer of (mm/yy). I already have a basic macro that will open up the
footers, change the date, move to the next footer, repeat until
necessary, and then close the footer view. The problem is that I have
to constantly edit the macro so the dates are what I need. If I open
up a document with a (02/06) date, and my macro is set up to find
(01/06), I need to edit the macro.
I simply want a macro that will search and replace more possibilities
at once. Whether the form has a (01/06) date or a (02/06) date, I want
to change it to (03/06). I'd be happy opening up the code once month
and changing that (03/06) to whatever date it is at the time.
Currently, my code is:
ActiveWindow.ActivePane.View.SeekView = _
wdSeekCurrentPageFooter
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
The bulk of the command runs 3 times because I don't know if can get it
to loop properly otherwise. The "On Error Resume Next" is in there
because sometimes the document will be fewer pages than the instances
of the "ActiveWindow.ActivePane.View.NextHeaderFooter" command.
Without, I get an error message and the macro doesn't run properly.
Thanks in advance for any help. Until then, I'll continue to search.
- Mike
and I've found plenty of information and answers to my problems - up
until now. I've spent a fair amount of time trying to find a solution
to this, but I've been coming up with nothing so far, which I find
somewhat embarrassing, as I've this seems like it should be rather
simple.
I update forms all the time - all of which have a version date in the
footer of (mm/yy). I already have a basic macro that will open up the
footers, change the date, move to the next footer, repeat until
necessary, and then close the footer view. The problem is that I have
to constantly edit the macro so the dates are what I need. If I open
up a document with a (02/06) date, and my macro is set up to find
(01/06), I need to edit the macro.
I simply want a macro that will search and replace more possibilities
at once. Whether the form has a (01/06) date or a (02/06) date, I want
to change it to (03/06). I'd be happy opening up the code once month
and changing that (03/06) to whatever date it is at the time.
Currently, my code is:
ActiveWindow.ActivePane.View.SeekView = _
wdSeekCurrentPageFooter
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(01/06)"
.Replacement.Text = "(03/06)"
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.View.NextHeaderFooter
On Error Resume Next
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
The bulk of the command runs 3 times because I don't know if can get it
to loop properly otherwise. The "On Error Resume Next" is in there
because sometimes the document will be fewer pages than the instances
of the "ActiveWindow.ActivePane.View.NextHeaderFooter" command.
Without, I get an error message and the macro doesn't run properly.
Thanks in advance for any help. Until then, I'll continue to search.
- Mike