Working with Aspose.Words in VB6 Document.Range.Replace_3

Hello,


Is Aspose.Words for VB6 supported? We are replacing Word automation in a small part of the software written in VB6 and would prefer to do it with VB6 (instead of C# wrapper assembly).

The function is supposed to extract document pieces from the original document to files.
Pieces that we want to copy start with “Message Begin:” and end with "Message End."

Looking through the examples gave us an impression that it can only be achieved by using IReplacingCallback interface. However, calling Document.Range.Replace method throws ‘Unable to Cast Object’ error. See code example below.

Dim helper As Aspose_Words.ComHelper
Dim doc As Aspose_Words.Document
Dim regex As RegExp
Dim pattern As String
Dim result As Long


Set helper = CreateObject(“Aspose.Words.ComHelper”)
Set doc = helper.Open(sourceFileAbsPath)
Set regex = New RegExp
regex.pattern = pattern

result = doc.Range.Replace_3(regex.Execute(doc.Range.Text), New ReplaceHandler, False)


Thank you

Hi,

We are investigating the issue and will update you soon.

Best Regards,

Hi,

There is some limitation when using Aspose.Words via COM. In this case Replace method expects a System.Text.RegularExpressions.Regex object but you are passing RegExp from Microsoft VBScript Regular Expressions 5.5 so such exceptions are expected.

Can you please share your complete code including ReplaceHandler class? Our product team will further analyze the issue if it can be fixed once you share the complete code.

Best Regards,