Can't determine Highlight of text from code. Used to work! RRS feed

  • Question

  • Hi

    I have this piece of code that I use to check if particular text (word, paragraph or whole document) is highlighted. Here is the code:

        Dim rngSearchRange As Object = wordDoc.Range 'Word.Range
        rngSearchRange = wordDoc.Range.Paragraphs.Item(Me.txtParagraphIndex.Text).Range
        rngSearchRange.End -= 1
        Dim c As Color = System.Drawing.Color.FromArgb(rngSearchRange.Font.Shading.BackgroundPatternColor)

    And it used to work (pretty sure about that) but right now it just returns Nothing (or -16777216  to be precise).

    It could be that .NET connects to a different Word Interop library than before but I'm not 100% sure.

    Has anyone here encountered similar problem? I'm kinda stuck with this. 


    Friday, March 18, 2011 11:21 AM