Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-02-2011, 12:14 PM
rhatx rhatx is offline Macro to update fields Windows 7 64bit Macro to update fields Office 2007
Novice
Macro to update fields
 
Join Date: Mar 2011
Location: Austin, Texas
Posts: 1
rhatx is on a distinguished road
Default Macro to update fields

Need help with this issue. We use a macro to automatically update fields in our documents. It works great except when you open a second document then the update fails and I get "Error! Not a valid file name" in the field. This failure happens 98% of the time, but sometimes it doesn't.
If I open the second file by itself the macro works fine.


This is the macro that I downloaded to update the fields upon opening the files:
Sub Document_Open()
Dim aStory As Range
Dim aField As Field
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub

Our typical field is as follows:
{INCLUDETEXT "spec project info.docx" projheader}

Any ideas?
Reply With Quote
Reply

Tags
fields, macro, update



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2002 duplicating updated calendar events RMTony Outlook 0 12-29-2010 11:48 AM
Macro to update fields office outlook 2010: the contents of this appointment have been updated. warakawa Outlook 1 10-04-2010 11:27 PM
VBA to update certain (but not all) fields sparkyrose Word VBA 0 05-20-2010 12:50 PM
editable fields only kingevil Word 0 05-04-2008 01:07 PM
Macro to update fields MS access fields quince Office 1 11-14-2005 07:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:05 PM.


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