Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2012, 04:27 AM
Catalin.B Catalin.B is offline Does Word have an option to update fields AUTOMATICALLY at open??? Windows Vista Does Word have an option to update fields AUTOMATICALLY at open??? Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, România
Posts: 386
Catalin.B is on a distinguished road
Default

Another thing you can do, is to place this code in Normal Template's This Document module, then place a button on the quick acces toolbar with this macro assigned, to update fields whenever you decide to...


Code:
Sub UpdateAllFields()

Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
    oStory.Fields.Update
    If oStory.StoryType <> wdMainTextStory Then
        While Not (oStory.NextStoryRange Is Nothing)
            Set oStory = oStory.NextStoryRange
            oStory.Fields.Update
        Wend
    End If
Next oStory
Set oStory = Nothing
End Sub
Reply With Quote
  #2  
Old 01-20-2012, 04:42 AM
Jamal NUMAN Jamal NUMAN is offline Does Word have an option to update fields AUTOMATICALLY at open??? Windows 7 64bit Does Word have an option to update fields AUTOMATICALLY at open??? Office 2010 64bit
Expert
Does Word have an option to update fields AUTOMATICALLY at open???
 
Join Date: Nov 2010
Posts: 615
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by Catalin.B View Post
Another thing you can do, is to place this code in Normal Template's This Document module, then place a button on the quick acces toolbar with this macro assigned, to update fields whenever you decide to...
Code:
Sub UpdateAllFields()

Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
    oStory.Fields.Update
    If oStory.StoryType <> wdMainTextStory Then
        While Not (oStory.NextStoryRange Is Nothing)
            Set oStory = oStory.NextStoryRange
            oStory.Fields.Update
        Wend
    End If
Next oStory
Set oStory = Nothing
End Sub
Hi Colin,

As I have already posted in the previous participation, can the macro (that you have provided) be developed to be embedded to a specific document (screenshot 1) such that:
· All the fields are updated when: save, save as, open or print are clicked
· All fields existing in the header and footer are updated are well
In this case, I think that I’m forced to save the document as *.docm, is that true?
Is there a way to have this property with the regular file extension (*.docx)?
Many thanks
Jamal
Attached Images
File Type: jpg Clip_300.jpg (108.4 KB, 57 views)
Reply With Quote
  #3  
Old 01-26-2012, 04:03 PM
Jamal NUMAN Jamal NUMAN is offline Does Word have an option to update fields AUTOMATICALLY at open??? Windows 7 64bit Does Word have an option to update fields AUTOMATICALLY at open??? Office 2010 64bit
Expert
Does Word have an option to update fields AUTOMATICALLY at open???
 
Join Date: Nov 2010
Posts: 615
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by Catalin.B View Post
Another thing you can do, is to place this code in Normal Template's This Document module, then place a button on the quick acces toolbar with this macro assigned, to update fields whenever you decide to...
Code:
Sub UpdateAllFields()

Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
    oStory.Fields.Update
    If oStory.StoryType <> wdMainTextStory Then
        While Not (oStory.NextStoryRange Is Nothing)
            Set oStory = oStory.NextStoryRange
            oStory.Fields.Update
        Wend
    End If
Next oStory
Set oStory = Nothing
End Sub
Hi Catalin,

I'm not sure if this code can be developed to be embedded in the document (and work through a macro) to update the fields automatically as we: save, save as, open, or print.

thank you

regards

Jamal
Reply With Quote
  #4  
Old 01-26-2012, 09:32 PM
Catalin.B Catalin.B is offline Does Word have an option to update fields AUTOMATICALLY at open??? Windows Vista Does Word have an option to update fields AUTOMATICALLY at open??? Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, România
Posts: 386
Catalin.B is on a distinguished road
Default

Quote:
Originally Posted by Jamal NUMAN View Post
Hi Catalin,

I'm not sure if this code can be developed to be embedded in the document (and work through a macro) to update the fields automatically as we: save,
It does not update automatically, just when you decide to, as i already said:
Originally Posted by Catalin.B
"then place a button on the quick acces toolbar with this macro assigned, to update fields whenever you decide to..."
But now you have a great solution from Paul...
Reply With Quote
  #5  
Old 01-26-2012, 11:43 PM
Jamal NUMAN Jamal NUMAN is offline Does Word have an option to update fields AUTOMATICALLY at open??? Windows 7 64bit Does Word have an option to update fields AUTOMATICALLY at open??? Office 2010 64bit
Expert
Does Word have an option to update fields AUTOMATICALLY at open???
 
Join Date: Nov 2010
Posts: 615
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by Catalin.B View Post
It does not update automatically, just when you decide to, as i already said:
Originally Posted by Catalin.B
"then place a button on the quick acces toolbar with this macro assigned, to update fields whenever you decide to..."
But now you have a great solution from Paul...
Sure. i understand.

I tried it and it worked very well! what i wanted is to Automate this behavior (updating fields) as we: save, save as, open or print

in the AutoCAD software, for instance, we could do this easily, we just mark it as an option and doesn't need much of work (attached). are the developer of the AutoCAD more a ware for the needs of the users than the MS Word developers? we are talking here about the same feature (updating fields). what takes ages in MS Word can be implemented in one click in the AutoCAD. Well, Word and AutoCAD are different, but as a user, when i compare the power of the same feature in these two software, i could guess which one is more efficient.

many thanks

Jamal
Attached Images
File Type: jpg Clip_46.jpg (124.9 KB, 20 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to update fields rhatx Word VBA 0 03-02-2011 12:14 PM
VBA to update certain (but not all) fields sparkyrose Word VBA 0 05-20-2010 12:50 PM
Can no longer update fields! slindsay Word 0 09-03-2009 05:10 PM
Automatically update text changes in word – Word 2007 webarnes Word 1 05-29-2009 02:48 PM
Automatically update text changes in Word - how do I do it? jonrm Word 2 05-21-2009 08:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft