+ Reply to Thread
Results 1 to 3 of 3

Word VBA IF table cell value = a Then - not working

  1. #1
    Registered User
    Join Date
    03-08-2016
    Location
    Newport
    MS-Off Ver
    2010
    Posts
    17

    Word VBA IF table cell value = a Then - not working

    Hi I have the following code that looks in a document for a sentence with 'pm' in - if found it replaces it with the vale is a master document table 2 cells 2,2.

    For some reason the IF statement is not working and always goes to the ELSE IF not replacing the text in the document - can any one help me with this as I've been stuck all morning.

    Please Login or Register  to view this content.
    Last edited by marylin123; 04-13-2016 at 05:35 AM. Reason: additional information

  2. #2
    Registered User
    Join Date
    03-08-2016
    Location
    Newport
    MS-Off Ver
    2010
    Posts
    17

    Re: Word VBA IF table cell value = a Then - not working

    The Immediate window does show that the cell content is being passed to the IF statement correctly just its not working!

  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: Word VBA IF table cell value = a Then - not working

    The problem with:
    timeon = wdDocSrc.Tables(2).Cell(2, 2).Range.Text
    is that it includes the end-of-cell marker. Try:
    Please Login or Register  to view this content.
    Note: I'm not sure what the point is of collecting 'TimeText', since it doesn't get used here.
    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. add Paragraphs in cell table in word
    By cvelle89 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2015, 05:38 AM
  2. Working with 1 date and days open IF a word appears in a cell
    By Deniroaus in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-26-2014, 09:22 PM
  3. Replies: 0
    Last Post: 07-28-2014, 10:36 AM
  4. [SOLVED] SaveAs as Table Cell in MS Word
    By gtbear in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2012, 09:48 PM
  5. Split cell as we do in table in word
    By PK Baranwal in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 03-09-2006, 03:00 AM
  6. [SOLVED] Embedding Word table in Excel cell
    By Larry Lester in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-24-2005, 01:05 PM
  7. [SOLVED] Paste from Word table so that 1 table cell = 1 Excel cell
    By Dave G in forum Excel General
    Replies: 4
    Last Post: 06-16-2005, 08:05 PM

Tags for this Thread

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