Consulting

Results 1 to 4 of 4

Thread: RichText CC Bug

  1. #1
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location

    RichText CC Bug

    Hi gents (and ladies),

    Posting a bug observation here for general consumption (comments). Will invite Jay Freedman from the Office Answers forum to review and possibly pass to the Word Development team (I'm not holding my breath that it will ever be fixed). The below image and attached .docm file will hopefully illustrate to you what I feel is a bug.

    If you wrap a richtext contentcontrol around a table, such that the table is at the very top of the CC range and attempt some seemingly simple VBA steps on the first cell of the table then the CC can be destroyed (obviously not desired). If you step through the macros in the attached I'm guess you will see the same observations (I did this with Word 2010).

    NOTE: I didn't want to monkey with you Normal template anymore than necessary so the BB created is deleted but you will get a prompt to save your Normal template.

    2020-01-16_19-22-13.jpg
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    If the CC is protected against deletion, you can't even write to the first cell in the table. Moreover, tables in CCs such as your document contains cannot be deleted - whether by VBA or otherwise - with or without the CC being protected against deletion. I drew the latter the MS's attention some years ago.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Paul,

    I know you are typically very thorough my friend, but "CANNOT"???

    Sub ScratchMacroVII()
    'A basic Word macro coded by Greg Maxey
    Dim oTbl As Table
    Dim oCC As ContentControl
    Dim oRng As Range
      Set oCC = ActiveDocument.SelectContentControlsByTitle("Bug Demo 7").Item(1)
      oCC.LockContents = False
      Set oTbl = oCC.Range.Tables(1)
      oTbl.ConvertToText
      oCC.Range.Text = vbNullString
    lbl_Exit:
      Exit Sub
    End Sub
    This will leave the empty richtext control showing placeholder text. It seems, as you have deduced yourself that Word\VBA somehow commingles the start/end of the table range with the start/end of the CC range.

    Edit - Paul I uploaded a revised file to illustrate. Does this address the issue you describe?
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Yes, you can do that, but you can't delete the table directly.
    Quote Originally Posted by gmaxey View Post
    This will leave the empty richtext control showing placeholder text. It seems, as you have deduced yourself that Word\VBA somehow commingles the start/end of the table range with the start/end of the CC range.
    If you switch Design Mode on, you'll see that Word has set the CC start within the tables...

    A workaround for both issues is to insert a space before the table at the design stage. Another workaround for both issues is to switch the table's wrap format to 'around' while working on it.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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