+ Reply to Thread
Results 1 to 15 of 15

Conditional mail merge assistance request

  1. #1
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Conditional mail merge assistance request

    Hi Excel expert friends,

    I want to create separate letter for each person who has 'W' remark in column 'J' on 'Data' sheet. The person's name in is in column 'F'. I want the name of person 'column F' as a file name for each one. If there is a dash sign in column 'J' then I don't want to create a letter for that person. I want to do it by using mail merge function in word.

    I'm in a urgent need of a macro to perform this mail merge to create letters for the persons who has a 'W' remark. Therefore, I request you experts to assist me to achieve this target at the earliest positively.

    The word file is in 'INPUT' folder.
    I want to save all letters for the persons in 'OUTPUT E' folder.

    Any help will be highly appreciated.

    Thanking you inn antici-0ation.
    Attached Files Attached Files
    Last edited by mso3; 12-02-2016 at 10:37 PM.
    Sincerely,

    mso3

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    Quote Originally Posted by mso3 View Post
    I'm in a urgent need of a macro to perform this mail merge.
    It's rude to wait until something becomes 'urgent' then expect volunteers to drop whatever else they're doing just to help you. Furthermore, there is plenty of code about - both here and elsewhere - that already does most of what you say you want. All you need do is adapt it to suit your needs. For example, the code in the Send Mailmerge Output to Individual Files topic in the the Mailmerge Tips and Tricks threads at:
    http://www.msofficeforums.com/mail-m...ps-tricks.html
    and:
    http://windowssecrets.com/forums/sho...ips-amp-Tricks
    could be adapted in a couple of minutes.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Extremely sorry for the word 'urgent'. I always appreciate all the members who assist me to solve the problems and respect them. I don't mean to be rude manner. I'm ready to wait for solution patiently. Please don't mind.

    I visited the sites you suggested but didn't find a solution to meet my requirement of conditional mail merge if there is a 'W' remark in column 'J'. Will you please suggest me a code to achieve it?

    Thanking you,

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    You didn't really expect to find a macro pre-coded to look for 'W' remark in column 'J' did you? As I said, the code would need to be adapted, which is a trivial undertaking:
    Please Login or Register  to view this content.
    Last edited by macropod; 12-03-2016 at 02:30 AM.

  5. #5
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi paul,

    Thank you for the code. I’m getting error as:

    ‘Method of data member not found’ on the following line

    Please Login or Register  to view this content.
    Thanking you,
    Attached Files Attached Files

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    Typo. Move that line to precede the 'End With'.

    Note: None of this additional code would be required if you were to use Word's mailmerge filter to filter out the unwanted records...

  7. #7
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Thank you.
    Now the macro is running without error but not creating the letters.
    Please Login or Register  to view this content.
    Thanking you,

  8. #8
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    The code in your last post works just fine for me. Did you look in the 'OUTPUT E\' folder?

  9. #9
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Greetings from me!

    Thank you.

    I checked the ‘OUTPUT E’ folder. It’s empty. I changed the path but in vain. Still I’m getting error ‘method of data member not found’ on the same line. Please see the code below and suggest me what’s wrong.
    Please Login or Register  to view this content.
    Thanking you,

  10. #10
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    The code in post #7 works with your data and folder structure as depicted in your attachement to post #1. If you're not actually using that structure - in terms of the folders, files and data therein - you can't expect to get the right results. Neither would it be reasonable to expect anyone else to figure out what the issue is.

    Furthermore, in post #7 you said:
    Quote Originally Posted by mso3 View Post
    Now the macro is running without error but not creating the letters.
    But now you're saying:
    Quote Originally Posted by mso3 View Post
    I changed the path but in vain. Still I’m getting error ‘method of data member not found’ on the same line.
    Why did you change the path? Unless it was wrong to begin with, all that would do is create problems.

    How about making sure your folders, files and data therein are exactly the same as what you depicted in post #1 and get that working before making changes...

  11. #11
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Greetings from me!

    Sorry! The error was from me and not by the code. After opening the word document the message pop up 'Opening this document will run the following sql command .... ... do you want to continue? No Yes
    Here I click on 'No' so the letters were not created. If I click on 'Yes' then the letters are creating successfully as per requirement.

    To avoide this mistake from the user can we make default setting to 'Yes' after opening the word document and make display alerts to false? So that there will be no problem.

    Everything else is fine. I appreciate you for the same.

    Thank you.

    Have a nice day.

  12. #12
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Conditional mail merge assistance request

    That can't be automated without a major re-write of the code - as much of a re-write as if the merge was being executed from Excel. Alternatively, a registry edit could be made - for every user who is likely to need to use the macro and that same edit would remove the prompt for every other merge they do, as well. Instead, a little user education is all that's required. After all, the same consideration arises for every mailmerge

  13. #13
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Excellent! Thank you for your kind cooperation and guidance.

    I appreciate you for the same.

    Thank you and have a nice day.

  14. #14
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Conditional mail merge assistance request

    Hi Paul,

    Excellent! Thank you for your kind cooperation and guidance.

    I appreciate you for the same.

    Thank you and have a nice day.

  15. #15
    Registered User
    Join Date
    01-25-2017
    Location
    USA
    MS-Off Ver
    office 3.0
    Posts
    5

    Re: Conditional mail merge assistance request

    Thanks for explaining in detail and it was really helpful

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Urgent help request for a mail merge vba code
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2016, 10:45 PM
  2. Code request for sending emails using mail merge function
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2015, 08:58 PM
  3. Assistance with a simple Mail Merge macro
    By L plates in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2015, 09:31 AM
  4. Request assistance with conditional formula
    By kbstone in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-29-2014, 11:51 AM
  5. Replies: 2
    Last Post: 01-22-2013, 11:37 AM
  6. Basic Mail Merge Assistance
    By cully1234 in forum Excel General
    Replies: 1
    Last Post: 02-16-2010, 06:32 PM
  7. Mail merge assistance please
    By Kevin J Prince in forum Excel General
    Replies: 2
    Last Post: 05-14-2006, 12:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1