first_page

My Word

I am making the final push to make the VBA prototype of Clean XHTML and found (or rediscovered) the following:

  • The Microsoft VBScript Regular Expression groupings seem to have a limit on string-length. This issue is a complete waste of time that will go away when the VBA prototype is rewritten in .NET.
  • There is a difference between Range.Style and Paragraph.Style. By design, Range.Style returns Nothing to indicate a mixed selection of styles (because a Range can cover overlapping Character and Paragraph Style selections). The implication is that a Paragraph.Style should never be Nothing because one paragraph will always have one style. There is no way for me to verify this without Microsoft documentation.
  • Table end-of-row markers (Chr$(13) & Chr$(7)) contain a Table object but no Cell objects. Not knowing this can give you hours of fun.
  • The XMLNodes.Add() method does not always return the node you just added. I was abused by this issue in this line of code: Set objNode = objCell.Range.XMLNodes.Add(strBaseBame, XHTML_NAMESPACE_URI).
  • The XMLNode.Range.Delete() method leaves one paragraph behind. I leave Microsoft to care and confirm or deny this issue. I assume that this behavior is by design because not to do this could make UI state management very complicated.
  • The Selection.Find.Execute() method can find previous matches again. One way to prevent handling duplicates is to search and one direction and use the Range.Start and Range.End (instead of Range.InRange()) to test for a duplicate entry.
  • Paragraphs demarked with the end-of-cell marker (Chr$(2)) in a Table Cell with multiple paragraphs should not be regarded as “real” paragraphs. For example, programmatically adding an XML node to such a paragraph can cause unexpected results.

Yes, I know that many of these problems are very obscure and almost useless information to people who do not program against Word so I list these problems here with much resentment from a time warp caused by corporate fat cats historically more concerned with time-to-market and feature-bloat-envy issues than authentic quality control.

rasx()