#16
|
||||
|
||||
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
That's what the snapshot I have in the email. It is from an actual document though it is only half a page.
I'll reconstruct the actual first page and send it. I'll send you a completed 1st page without an names on it, only the blank template. |
#18
|
||||
|
||||
Yes, but the snapshot doesn't show, for example:
• whether the title lines are all one paragraph, or separate paragraphs; • whether the space between those lines and the "Name of Participant" line results from a paragraph before/after space setting or an empty paragraph; or • what the space between the "Name of Participant" and the rest of the text on that line consists of. Indeed, it's quite possible all that structure is maintained in a table, with separate cells for the data.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#19
|
|||
|
|||
I see what you mean;
Franklin Resources would have an enter after Inc. creating a new paragraph starting It would be like this 1) Franklin Resources, Inc. (enter - starting a new paragraph with Amended) 2) Amended ... Plan (enter - starting a new paragraph beginning with Notice) 3) Notice ... Award(enter - starting a new paragraph beginning blank line) 4) BLANK (enter beginning a new paragraph with Participant) 5) Name of Participant: The Enter key was hit 4 times and Name of Participant begins on the 5th row. Does this help? Michaeo |
#20
|
||||
|
||||
If that is indeed the structure (e.g. with no empty paragraphs before "Franklin Resources, Inc." and that and each line is terminated via Enter rather than Shift-Enter), then the "Name of Participant:" is the 5th paragraph as I surmised. I'd still need to know exactly what the document contains between "Name of Participant:" and the actual name.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#21
|
|||
|
|||
Between the "Name of the Participant:" and the actual name, Swagato Ghosh in this instance, are a couple of spaces put in by the space bar - the enter (return) key is not used.
Does this make a difference? Michael |
#22
|
||||
|
||||
Yes. The code would need to be modified to suit.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
So to modify the code, I would first have to modify the the paragraph object from (1) to (5)
from Set Rng = .Range.Paragraphs(1).Range To Set Rng = .Range.Paragraphs(5).Range Is there any other line of code that I would need to alter to pick up the name starting at the 23 character on that line (the string length of Name of Participant: plus 2 extra spaces). Michael |
#24
|
||||
|
||||
See my comments in post 12: https://www.msofficeforums.com/mail-...tml#post136694
As I said there, though, the StrTxt mods depend on what is in that paragraph - and for that I need to see the actual document.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#25
|
|||
|
|||
Hi Paul
Attached is a sample word document. I can't remember everything on the page but this is most of it. If you need an exact replica I'll need to go into the office to be able to send you one. We're off this week so I won't be able to get it until next week. After this page is a a signature sheet followed by a number of appendices. total length for 1 PDF will be 35 pages for one type of stock and 15 pages for a different plan. I will be making a PDF for each employee under each plan (about 500 different PDF documents). Will this sample work? Thank you for your help. |
#26
|
||||
|
||||
I'd rather wait to see the actual content and do the coding once...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#27
|
|||
|
|||
Will do, I'll send this to you next Wednesday when I get back to work.
Merry Christmas |
#28
|
|||
|
|||
Hi Paul,
Here is one of the actual documents, can you let me know what I need to tweak in your code to make it work? Thank you for your help, Michael |
#29
|
||||
|
||||
Replace:
Code:
' Get the 1st paragraph Set Rng = .Range.Paragraphs(1).Range With Rng ' Contract the range to exclude the final paragraph break .MoveEnd wdCharacter, -1 StrTxt = .Text For k = 1 To Len(StrNoChr) StrTxt = Replace(StrTxt, Mid(StrNoChr, k, 1), "_") Next End With Code:
' Get the 1st cell's content StrTxt = Split(.Tables(1).Cell(1, 1).Range.Text, vbCr)(0) For k = 1 To Len(StrNoChr) StrTxt = Replace(StrTxt, Mid(StrNoChr, k, 1), "_") Next
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#30
|
|||
|
|||
I'll look into that, great idea.
I'll see how the macro words on what I have already. Michael |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert particular blocks of text within a word document to tables using macro | benbob | Word VBA | 5 | 07-15-2018 03:20 AM |
Mail Merge Macro | ch1325 | Word VBA | 2 | 06-08-2015 06:18 AM |
Mail Merge Macro | spc94 | Word VBA | 2 | 06-04-2015 07:06 AM |
Convert mail merge to PDF then email | TeriJean | Mail Merge | 0 | 10-04-2011 03:52 PM |
Word Doc Macro (mail Merge) | ajolson1964 | Word VBA | 1 | 05-10-2011 10:15 PM |