Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-18-2012, 03:19 AM
Oliver Beirne Oliver Beirne is offline Auto update Filename field Windows XP Auto update Filename field Office 2007
Novice
Auto update Filename field
 
Join Date: Jan 2012
Posts: 7
Oliver Beirne is on a distinguished road
Default Auto update Filename field

Hi

I have some VBA that opens all Word documents in a given folder, pastes their content into a blank template then saves with the original filename in a new folder.



As part of this I want the filename field in the header of the new documents to automatically update with the document filename. I nknwo you can use F9 but I don't want this to be a task for the document users.

I've seen some vba examples such as:
Code:
 
Dim aStory As Range 
Dim aField As Field 
 
' Automatically update all fields in document when it is opened
For Each aStory In ActiveDocument.StoryRanges 
  For Each aField In aStory.Fields 
    aField.Update 
  Next aField 
Next aStory
but these all appear in their own sub routines and when I try to add it to my exisiting code it doesn't work.

I'd really appreciate any pointers on how to solve this, thanks.

Last edited by macropod; 10-18-2012 at 02:33 PM. Reason: Added code tags & formatting
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
auto update slide on viewing videoman PowerPoint 0 07-11-2012 06:29 AM
Table of Contents - Direct Field Implementation - Auto-Update Numbering ztag Word 3 01-19-2012 03:04 PM
Auto update Filename field Use a mail merge Field as the final doc filename DaveBF Mail Merge 1 10-22-2011 10:16 PM
Auto Update the date. Nirik Excel 16 12-16-2010 04:23 AM
Project Auto-Update hB-sys Project 0 04-15-2010 06:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:04 AM.


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