For COM+ (i.e. with IIS) users click here.
One very important note is that ConvertXLS.EXE is both an executable application AND an ActiveX component. That is, the file, ConvertXLS.EXE, can be ran as a stand-alone application, and can be referenced as a component within your development environment.
In development environments such as VBA you may use something similar to the lines of code below to create an instance of the 'Convert XLS' application object:
Dim oConvertXLS as Object
Set oConvertXLS = CreateObject("ConvertXLS.clsConvertXLS")
Call oConvertXLS.DoCommandLine("/SC:\In\Account.xls /F-4143 /N1 /TC:\in\Account.txt /C6 /M1")
Directly below is some VBS (Visual Basic Script). You could put the following 3 lines in a text file, call it Test.VBS and give it a go:
set converter = WScript.CreateObject("ConvertXLS.clsConvertXLS")
result =
converter.DoCommandLine("/SC:\In\Account.xls /F-4143 /N1
/TC:\in\Account.txt /C6 /M1")
MsgBox(result)
For Visual Basic users, simply make a reference to the ConvertXLS.EXE application in the Tools\References menu item. Once done you now have access to the ConvertXLS component. Here is some sample code illustrating its usage:
To download demonstration source code (VB6 and VB.NET) click the following links:
Public WithEvents cx As ConvertXLS.clsConvertXLS
Private Sub Command1_Click()
Set cx = New clsConvertXLS
cx.Key = "" ' Assign Key To the 'Final Key', given upon registration.
' Run by the command line. See 'Convert XLS' documentation for a full
listing of
' switches and options.
lRetVal = cx.DoCommandLine("/JE:\Jobs\Test.SII")
If (lRetVal = 0) Then
Call MsgBox("Success", , "Automation
Testing")
End If
' DoCommandLine() Return Values
' 0 = Success
' -1 = Shareware expired
' -2 = Command line string empty
' -3 = Missing required command line argument(s)
Set cx = Nothing
End Sub
Sub cx_OnError(lErrorNumber As Long, sErrorString As String)
Call MsgBox("Error " & CStr(lErrorNumber) & " occurred. [" &
sErrorString & "]")
End Sub
As you can see from the code above, the ActiveX wrapper simply wraps the command line feature. So, to learn what you can do with the ActiveX, please refer to the 'Using the Command Line' section of the 'Convert XLS' user's manual. Also, you will have to change the path information in the DoCommandLine() method for your particular set of files you are comparing.
DoCommandLine()
DESCRIPTION:
This function emulates
doing the command line, but through the COM interface.
RETURN VALUES:
0 = Success
-1 = Shareware expired
-2 = Command line String empty or invalid
-3 = Missing required command line argument(s)
None
OnError(lErrorNumber
As Long, sErrorString As String)
DESCRIPTION:
When an error occurs this event is triggered supplying both the error code and description. This can be very helpful while troubleshooting and developing.