none
CODE TO CONDITIONALLY PLACE PARAGRAPH IN WORD BASES ON VALUE IN EXCEL RRS feed

  • Question

  • I was wondering if anyone out there knew how to put a paragraph in word Using VBA conditionally based on the value of a cell. For example, if a cell says "yes" or "no" place a paragraph in a word document.
    Thursday, December 11, 2014 7:17 PM

Answers

  • Hi SEBB,

    We could control word from excel.

    For your requirement, you could refer to these steps below:

    1. Create a word object (CreateObject(“word.Application”) and open a document
    2. Get the specify cell/range value
    3. Base on the value to add paragraph or do other logical in the word
    4. Save that word

    There are some links that can help you:

    # How to use Automation with Word

    http://support2.microsoft.com/Default.aspx?kbid=307216

    # VBA macro examples to insert text into a document in Word

    http://support.microsoft.com/KB/212682

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 16, 2014 8:36 AM
    Moderator

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the MSDN forum for Office

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=officegeneral&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Friday, December 12, 2014 7:38 AM
  • We need some more info here. By cell you mean a table cell in Word? or Excel or what. Maybe a little example will help explain your question.

    Do you have a word document with a table and in table cell one it says Yes?


    Maurice

    Friday, December 12, 2014 9:59 AM
  • Hi SEBB,

    We could control word from excel.

    For your requirement, you could refer to these steps below:

    1. Create a word object (CreateObject(“word.Application”) and open a document
    2. Get the specify cell/range value
    3. Base on the value to add paragraph or do other logical in the word
    4. Save that word

    There are some links that can help you:

    # How to use Automation with Word

    http://support2.microsoft.com/Default.aspx?kbid=307216

    # VBA macro examples to insert text into a document in Word

    http://support.microsoft.com/KB/212682

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 16, 2014 8:36 AM
    Moderator