Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #16  
Old 12-23-2018, 02:51 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default


Quote:
Originally Posted by bearcublandon View Post
I'll create a document for you following the format I recall. I'll also create a dummy second sheet so it will print more than one.
I'd prefer a copy/paste or extract from an actual document that your system has already generated. That way, there's no memory issues to skew things. I don't need a data sheet.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #17  
Old 12-23-2018, 02:56 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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.
Reply With Quote
  #18  
Old 12-23-2018, 03:04 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #19  
Old 12-23-2018, 03:14 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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
Reply With Quote
  #20  
Old 12-23-2018, 03:18 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #21  
Old 12-23-2018, 06:03 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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
Reply With Quote
  #22  
Old 12-23-2018, 06:05 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by bearcublandon View Post
Does this make a difference?
Yes. The code would need to be modified to suit.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #23  
Old 12-23-2018, 06:17 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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
Reply With Quote
  #24  
Old 12-23-2018, 06:25 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

See my comments in post 12: http://www.msofficeforums.com/mail-m...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
[MS MVP - Word]
Reply With Quote
  #25  
Old 12-23-2018, 07:34 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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.
Attached Files
File Type: docx Sample Ben Template.docx (12.9 KB, 1 views)
Reply With Quote
  #26  
Old 12-23-2018, 08:53 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

I'd rather wait to see the actual content and do the coding once...
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #27  
Old 12-24-2018, 11:22 AM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

Will do, I'll send this to you next Wednesday when I get back to work.

Merry Christmas
Reply With Quote
  #28  
Old 01-02-2019, 06:00 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

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
Attached Files
File Type: docx Format.DOCX (85.8 KB, 2 views)
Reply With Quote
  #29  
Old 01-02-2019, 06:07 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,367
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
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
That said, since it's clear you have access to the mailmerge main document, one has to wonder why you don't use the approach mentioned in post #2.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #30  
Old 01-02-2019, 07:17 PM
bearcublandon bearcublandon is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 24
bearcublandon is on a distinguished road
Default

I'll look into that, great idea.

I'll see how the macro words on what I have already.

Michael
Reply With Quote
Reply

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


All times are GMT -7. The time now is 06:13 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft