Free Support Forum -

ASP / VBScript Example Code

Can anyone provide me with a short script illustrating the basics of using ASPose.Excel with ASP / VBScript.

While it does seem possible to create a sheet, I have not been able to select a cell and write to it.

I need to;
- create an excel object
- select a sheet
- write to cells
- save the sheet
- open the sheet in the browser

This doesn’t seem very complex but I am at a loss to get ASPose.Excel to work. I’m hoping that I’ve just missed some step that you can illustrate in some example code.

Follow up to my original post - it's been a couple of days since I posted my request for sample code to illustrate how to use Aspose.Excel with ASP / VBScript. During that time I've played around with Apsose.Excel without a lot of luck.
I can create an object, get a sheet, get the cells - but I have not been able to access an individual cell in order to do a .PutValue().

dim excel0
set excel0 = CreateObject("Aspose.Excel.Excel")

dim worksheet0
set worksheet0 = excel0.Worksheets.Item(0)

dim cells0
set cells0 = worksheet0.Cells

cells0.StandardHeight = 20

dim cell0
set cell0 = cells0(0, 0) ' does not work
set cell0 = cells0.Item(0, 0) ' does not work
cell0.PutValue("test") ' does not work

Everything works - up to the point where I try to access a single cell.

Any idea why this doesn't work?

Sorry for my later reponse.

I am not familiar with ASP/VB script, so it will spend some time to investigate it. I will check your issue.

Now could you try:

set cell0 = cells0(“A1”)

set cell0 = cells0(“A1”)

gives the error…
Error Type:
Microsoft VBScript runtime (0x800A01AE)
Class doesn’t support Automation

then I tried…
set cell0 = cells0(0)

gives the error…
Error Type:
mscorlib (0x80131502)
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

You right, it might be caused by overloads. The following is from MSDN.


Overloaded Methods

Although .NET supports overloaded methods, the IDispatch interface relies solely on method name for binding, rather than the complete method signature. It is therefore not capable of supporting overloaded methods. However, to provide access to overloaded methods of a type, Tlbexp.exe decorates the names of overloaded methods with an ordinal number so that each method name is unique.

The following managed and unmanaged signatures show the inclusion of numbers:

Managed signature

interface INew { public: void DoSomething(); void DoSomething(short s); void DoSomething(short l); void DoSomething(float f); void DoSomething(double d); }

Unmanaged signature

interface INew { void DoSomething(); void DoSomething_2(short s); void DoSomething_3(short l); void DoSomething_4(float f); void DoSomething_5(double d); }

The COM signature for the methods appears as a single DoSomething method followed by a series of decorated DoSomething_x methods, where x starts at 2 and increments for each overloaded form of the method. Note that some of the overloaded methods can be inherited from a base type. However, there is no guarantee that overloaded methods will retain the same number as the type version advances.

Although .NET clients can use the overloaded form of the method, COM clients have to access the decorated methods. Object browsers display all forms of the decorated method with the method signature to enable you to select the correct method. The late-bound client can also call IDispatch::GetIdsOfNames, passing in the decorated name to get the DispID of any overloaded method.


I think in your case these will map to the overloaded Item property.


You can poke each of them or I guess you can try using Type Library Exporter (Tlbexp.exe) tool to actually see what names were assigned to which overloads.

Hi, good call - yes this method can be used to get at the overloaded methods.


dim cell0
set cell0 = cells0.Item_2(0, 0)

… works! Allowing me to put the value “test” into a cell.

That’s a reasonable workaround, thanks for your help.

Follow up question in a similar vein - how would I get at the enum values used throughout? E.g. SaveType.OpenInPlace or FileFormatType.Default

E.g. if I want to use the Save method I’ll need to know…

excel.Save(“test.xls”, SaveType.OpenInPlace, FileFormatType.Default, Response)

Are there int values documented? Or perhaps a similar name mangle rule?

If you look in the documentation, say for FileFormatType

Then the values will normally be 0, 1, 2, 3, 4 etc for members of the enumeration.

This might not work in some cases if the enum values were explicitly assigned by Aspose.Excel developers, but this is seldom used.

So you mean the FileFormat enums would be like FileFormat_2?

I’m not familiar with tlbexp? How would I use it to view these enums and overloads?

Just try passing 1 (the integer value) to specify Default format.