![]() |
|
#1
|
||||
|
||||
![]() 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] |
#2
|
|||
|
|||
![]()
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). ![]() |
#3
|
||||
|
||||
![]()
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] |
![]() |
|
![]() |
||||
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 |
![]() |
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 |