Replacement for Microsoft.Office.Core.CommandBarComboBox

Is there a way to replace the following code using the Aspose.Words library, since it requires MS Office to be installed on the machine?

Private wordDoc As Microsoft.Office.Interop.Word.Document
wordDoc = New Microsoft.Office.Interop.Word.Document()

wordDoc = wordApp.Documents.Open($"C:\TestPath\Test.DOCX")
wordDoc = wordApp.ActiveDocument

Dim cmbControl As Microsoft.Office.Core.CommandBarComboBox
cmbControl = wordDoc.CommandBars("CommandBarA").Controls("Insert CommandBar Fields")

@jeganathan

Aspose.Words does not expose the Word UI model (CommandBars, CommandBarComboBox, etc.). The library works only with the document object model – you can read, modify and save DOCX files without any Office installation, but UI elements such as wordDoc.CommandBars("CommandBarA").Controls("Insert CommandBar Fields") are not available.

If the goal is to insert a field (or a set of fields) that the original command bar combo box would add, use the document‑processing API, e.g.:

Dim doc As New Aspose.Words.Document("C:\TestPath\Test.docx")
Dim builder As New Aspose.Words.DocumentBuilder(doc)

'example: insert a MERGEFIELD
builder.MoveToDocumentEnd()
builder.InsertField("MERGEFIELD  MyField  \\* MERGEFORMAT")

doc.Save("C:\TestPath\Result.docx")

Replace the field code (MERGEFIELD, REF, etc.) with whatever the command bar combo box was inserting.

If you need to replicate more complex UI‑driven behavior, you will have to implement it yourself (e.g., a custom form or dropdown in your application) and then use Aspose.Words APIs to apply the corresponding changes to the document.

Assumption: the original command bar combo box was used to insert fields; if it performed a different action, please provide the exact operation so we can suggest the appropriate Aspose.Words API.

Yes, the command bar combo box is used to insert fields;

Thanks for sharing the above example and it is useful.

Also, How do we convert or validate the below code using Aspose.Words. Any recommendations ?

Dim cmbControl As Microsoft.Office.Core.CommandBarComboBox
cmbControl = wordDoc.CommandBars("CommandBarA").Controls("Insert CommandBar Fields")

If cmbControl.Tag.ToString() = "4,0" Or cmbControl.Tag.ToString() = "4" Then
   cmbControl.Tag = "4"
ElseIf cmbControl.Tag.ToString() = "92,0" Or cmbControl.Tag.ToString() = "92" Then
   cmbControl.Tag = "92"
End If

wordDoc.CommandBars("CommandBarA").Controls("Insert CommandBar Fields").Tag = "22, 28, 38, 32, 37, 50"

@jeganathan As it was mentioned above Aspose.Words works with actual document and does not interact with MS Word UI. The above provided code does not do anything with a document itself. So there is no way to replace this code with Aspose.Words. If possible, could you please describe what is needed to be done?