Skip to content

[Bug]: Workbook_Open always fails on perpetual/LTSC Excel - AddCommentThreaded is called without a capability guard #10

Description

@BekbolatBK

ProjectEngine version

v1.2.5

Excel version and language

Microsoft Excel LTSC, MSO version 2608 (build 16.0.20326.20072), 64-bit, Russian UI

Affected area

Localization

Expected result

Opening the workbook completes without a STOP on Excel builds that do not expose the threaded-comments VBA object model. The onboarding help comments are skipped (or fall back to legacy comments), and the localized button captions are still applied.

Actual result

Every time the workbook is opened, before any user action, a STOP appears:

Error in WBS_ApplyLanguage: the VBA object model for threaded comments
is not supported in your version of Excel
(localized message; Excel LTSC / perpetual build)

The floating buttons are created, but their localized captions and the onboarding help comments are never applied, because WBS_ApplyLanguage aborts at that point.

It happens on every open, with or without data in tbl_WBS.

Reproduction steps

  1. Use an Excel build without the threaded-comments VBA object model (perpetual / LTSC - see the version field above).
  2. Open Excel/ProjectEngine_v1.2.5.xlsm and enable macros.
  3. Workbook_Open calls Ensure_WBS_Main_Buttons, whose last statement is WBS_ApplyLanguage.
  4. The STOP appears immediately, with no user action.

Reproduced on the v1.2.5 release asset.

Anonymized example or screenshots

Root cause. WBS_Onboarding_ThreadedCommentText swallows the error and reports "no comment":

commentExists = False
On Error Resume Next
Set threadedComment = cell.CommentThreaded
On Error GoTo 0
If threadedComment Is Nothing Then Exit Function
commentExists = True

On a build without the API the property raises, commentExists stays False, and the caller cannot distinguish "this cell has no threaded comment" from "this Excel cannot answer the question".

WBS_Onboarding_ApplyLocalizedContent then acts on that False and calls the same unavailable API unguarded:

If WBS_Onboarding_CellHasLegacyComment(helpCell) Or _
    Not hasThreadedComment Or _
    WBS_Onboarding_NormalizeComparisonText(actualText) <> _
        WBS_Onboarding_NormalizeComparisonText(expectedText) Then
    WBS_Onboarding_ClearCellComments helpCell
    helpCell.AddCommentThreaded expectedText
End If

The same mechanism makes the guard upstream useless: in WBS_Onboarding_LocalizedContentIsCurrent the failing read routes to NotCurrent, so the check returns False on every call and the apply step runs every time.

Both procedures are byte-identical in ProjectEngine_v1.2.5.xlsm and in Excel/ProjectEngine.xlsm at commit 9e66bc8 (verified by extracting the VBA project from both workbooks), so v1.2.5 does not change this path.

Additional context

Suggested fix. Probe the capability once, cache it, and skip the threaded-comment branch when it is absent - falling back to legacy comments or to no comments at all. Equivalently, let WBS_Onboarding_ThreadedCommentText return three states (present / absent / cannot determine) instead of two: the caller must not treat "cannot ask" as "absent", because it then writes through an API that does not exist.

This is the same class as the invariant stated in ARCHITECTURE_READING_GUIDE.md about never converting a safety fallback into a generic result - here an unavailable API is converted into a data fact.

Filed separately from the S-Curve signature issue because the area and the fix differ. Thanks for the architecture guide - it made both causes quick to locate.

Submission checks

  • I tested the latest available release.
  • I removed confidential and company-specific information.
  • I searched existing Issues and Discussions for the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions