+ Reply to Thread
Results 1 to 3 of 3

Excel to Word: Select only Word cell's text and not the cell range

  1. #1
    Registered User
    Join Date
    02-17-2020
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    28

    Excel to Word: Select only Word cell's text and not the cell range

    Hi,

    I am creating a word file using Excel VBA. On the front page it contains a table with some information about the document, such as issue, reference number etc. I would like to have some of these shown in my header using fields.

    What I tried so far is:

    Please Login or Register  to view this content.
    However, this code only copies the dcmtTable cell's formatting, not the text. If I use Word's macro recorder, carefully select only the text "1.0" manually and add a bookmark for this text, it works. So how can I select specifically .Cell(2, 2)'s text and not the whole range? So far I haven't found a working solution online. Thank you in advance!

    Note: Also posted here a couple of hours ago but no answer so far https://stackoverflow.com/questions/...elect-only-a-c, therefore I'll chance my luck here.

  2. #2
    Registered User
    Join Date
    02-17-2020
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    28

    Re: Excel to Word: Select only Word cell's text and not the cell range

    Solved with this solution: https://stackoverflow.com/questions/...elect-only-a-c

  3. #3
    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: Excel to Word: Select only Word cell's text and not the cell range

    All you need to is apply a series of unique Style names to each of the cells concerned, then insert STYLEREF fields into the page header referencing those Styles, both of which you'd do to your template before running your code. That way, there's no need to concern yourself with bookmarking, cross-referencing the content, or updating the cross-references.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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. [SOLVED] Excel vba to find and delete a certain word plus the adjacent word in a cell
    By hoss88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2018, 08:46 AM
  2. [SOLVED] Find text in word in the cell and replace whole word
    By Grens in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-31-2016, 01:44 PM
  3. Excel formula switch first and Second word but keeps 3rd and remaining word in single cell
    By iwanttoexcelinexcel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-29-2015, 04:22 PM
  4. [SOLVED] In Excel, how do I find one word in a set of text in a cell?
    By man818 in forum Excel General
    Replies: 6
    Last Post: 06-10-2015, 05:33 PM
  5. Select Image In Excel Cell and paste to Word Doc Error 438
    By southcraven in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-15-2014, 06:48 AM
  6. Check cell for word, If word exists in cell, assign that cell to corresponding category.
    By Trevasaurus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2012, 12:35 PM
  7. Copying 2 paragraps in Word.Range to Excel.Cell
    By souravsain in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2008, 01:12 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