Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2015, 04:48 PM
macropod's Avatar
macropod macropod is offline Batch re-naming Windows 7 64bit Batch re-naming Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


I've split your post from https://www.msofficeforums.com/word-...oned-body.html to a new thread, as the issue is quite different.

Do you not know where in the document the "Policy _________" string occurs? The code in your post assumes you want the text from the first paragraph in the document. It could just as easily be pointed to any other paragraph. Also, what, exactly, does the paragraph containing the "Policy _________" string contain? If it contains any characters that are illegal for a filename, those characters must be removed before you try saving the file.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 06-16-2015, 04:09 AM
twols26 twols26 is offline Batch re-naming Windows 7 32bit Batch re-naming Office 2010 32bit
Novice
Batch re-naming
 
Join Date: Jun 2015
Location: Canada
Posts: 4
twols26 is on a distinguished road
Default

I'm trying to do is rename a batch of 200+ files as above by pulling the policy number following the word "Policy" found in the document. I'm wondering if I can reference it to a particular line of information in the word document, and how I would do so? I had tried using a macro where it renamed the document with the first line of information on the page, and I simply added a mail merge line (in white font) as the first line so that it would pull this information, but not show in print. Unfortunately it did not work... and am wondering if my first idea might work better. Can anybody help me create a macro where I take a particular line (and tell me how I should reference to a particular point)?

Letter looks like this:

Date

Address 1
Address 2
Address 3
Address 4

Policy XXXXXXXXX

<Body>

Policy number can change in # of characters depending on the type of plan code it is; so I'm not sure how to search something like that with parameters (which is why I'm wondering how to pull an entire line of information to rename the documents within a particular folder).

I also don't want a macro that creates a duplicate file (resulting in two of the same document with different names - as I have read within threads this can cause problems with loop).

Big thanks in advance!
Reply With Quote
  #3  
Old 06-16-2015, 05:39 AM
macropod's Avatar
macropod macropod is offline Batch re-naming Windows 7 64bit Batch re-naming Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by twols26 View Post
Letter looks like this:

Date

Address 1
Address 2
Address 3
Address 4

Policy XXXXXXXXX

<Body>
In that case, if the document is formatted correctly, the policy # should always be in the 3rd paragraph. Hence, it's just a matter of getting the text from that paragraph and stripping off anything illegal/irrelevant for the naming.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming Cells for formula referencing lynchbro Excel 6 06-26-2014 07:45 AM
Naming plot-line breaks dates on x-axis Sammael Excel 0 06-01-2013 03:29 PM
Batch re-naming re-naming arrays in VBA? JDevsFan Excel Programming 4 03-15-2012 08:44 AM
Auto file naming Rong Peng Word VBA 0 07-29-2011 07:37 AM
Auto-File Naming/ Default Directory Saves sgill32 Word 2 11-06-2008 02:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:06 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