Charles
Mon May 09 15:32:22 CDT 2005
Note that a DocVariable field in a footer will crash Word 97.
--
Charles Kenyon
Word New User FAQ & Web Directory:
http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
http://addbalance.com/usersguide
See also the MVP FAQ:
http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"SeanP" <SeanP@discussions.microsoft.com> wrote in message
news:97235624-B99B-4998-8D86-853F53DEF12A@microsoft.com...
> Whoops left the old code there
>
> oField.Type = wdFieldDocVariable
>
> was what it should have been.
>
> I am noticing now though on some of my larger docs with more fields in it,
> the DocVariable in my footer is not being updated. Yet it works in other
> documents just fine ... anyone know why this would be?
>
> "SeanP" wrote:
>
>> After searching (which I should have done a bit more of before posting) I
>> found code I could modify to do it, what would I do to specify a specific
>> variable?
>>
>> Sub RefFieldUpdateAllStory()
>> Dim oField As Field
>> Dim oStory As Range
>> For Each oStory In ActiveDocument.StoryRanges
>> Do
>> For Each oField In oStory.Fields
>> If oField.Type = wdFieldRef Then
>> oField.Update
>> End If
>> Next oField
>> Set oStory = oStory.Next
>> Loop Until oStory Is Nothing
>> Next oStory
>> End Sub
>>
>> "SeanP" wrote:
>>
>> > Hey I am pretty new to VBA and am trying to set up a macro that will
>> > update
>> > all of the fields in a document that are DocVariables. Some are in the
>> > body
>> > of the document and in the header/footer. I have one set up that will
>> > update
>> > all fields, but that is doing more than it needs to as it does the TOC
>> > and
>> > all the inclused text.
>> >
>> > Also anyone know of a good reference for object naming conventions in
>> > Word
>> > VBA, I program in other languages so the language structure is easy to
>> > pick
>> > up, just shakey on accessing the objects I want to.
>> >
>> > Thanks