Macro troubleshooting: Promoting headers

Post Reply
Bobsterz
Posts: 4
Joined: Tue Aug 18, 2026 9:58 pm

Macro troubleshooting: Promoting headers

Post by Bobsterz »

I need to try a macro, because TextMaker converts body text to headers when a selection including body text is demoted.
I tried AI, but the variables were unrecognized.

So... CoPilot recommended I ask this way, under the impression that maybe my subscription to SoftMaker Office NX does not include what I need to do this kind of macro.

"Does TextMaker NX Home expose the document object model (ActiveDocument, Selection, Paragraphs, Style, OutlineLevel) in BasicMaker? If not, is there any supported way to select only headings or promote outline levels via macro?"

I'm using TextMaker NX Home (rev S1502.0808) 64bit in Windows 10.

- - - - - The AI-generated macro (that didn't work in my version of TextMaker - - - - -

Sub PromoteSelectedHeadingsOnly

Dim sel As Selection
Dim p As Paragraph
Dim styleName As String
Dim lvl As Integer

Set sel = ActiveDocument.Selection

' Loop through all paragraphs in the selection
For Each p In sel.Paragraphs

styleName = p.Style.Name

' Check if the paragraph style matches "Heading X"
If Left(styleName, 7) = "Heading " Then

' Get current outline level
lvl = p.OutlineLevel

' Promote only if not already at top level
If lvl > 1 Then
p.OutlineLevel = lvl - 1
End If

End If

Next p

End Sub
lgsl
Posts: 317
Joined: Wed Mar 04, 2020 8:00 pm

Re: Macro troubleshooting: Promoting headers

Post by lgsl »

I am guessing this is related to this post. AS I asnwered there, I think you came across a bug.

I do not use NX, not do I use Windows, witch rules out me trying whatever is going on with your macro, however... Copilot is terrible (in general, for everything), and the macro it made for you is probably tailored to MS Office and it is assuming that TextMaker and BasicMaker works the same way as MS Office macros. That's AI for you...
Post Reply

Return to “SoftMaker Office for Windows (General)”