We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert vb script to aspose


I have a huge vb script (excel ) and need to convert it to in aspose.
is there any converter available ?
any solution plz ASAP

could you share me your’s email id so that I can send you the entire script.

Thanks in advance


Well, there is no such tool available. I am afraid, you have to write your own code by yourself using Aspose.Cells APIs for creating and managing Excel spreadsheets. We can help you if you find any issue/problem with using Aspose.Cells APIs or implementing MS Excel features via Aspose.Cells APIs.

Please go through the Aspose.Cells (Programmer’s Guide) Docs for your complete reference:
Please browse different sections/sub-sections to check/open the documents/articles with examples (in the Docs) for your reference, it will help you on how to use different MS Excel features via Aspose.Cells APIs.

Also, see the Aspose.Cells for .NET API Reference pages:

You can also download and run VS.NET demos/examples solutions (with source files) for your further reference:

Hope, this helps you a bit.

Thank you.

I have converted the excel vb code in Microsoft.Office.Interop.Excel.

So is there any tool to conver Microsoft.Office.Interop.Excel code into aspose?


Thanks fro you prompt response.

Could you please convert the below function code into aspose.

public void FormatColumnB()
// Run down column B and format it
// Remove the closing label and the row after it
int LastRow;
int RowLocation;
int FirstLevel;
LastRow = (activeSheet.UsedRange.Rows.Count) - 5;
RowLocation = 13;
FirstLevel = 0;
// Loop From Row 13 to the last row in flight area
fullRange.Cells[RowLocation, 2].Select();
if (fullRange.Cells[RowLocation, 2].value != null && fullRange.Cells[RowLocation, 2].value != “”)//.value added as exception was thrown
// Found a non-blank row
if (FirstLevel == 0)
// Found the opening label
FirstLevel = 1;
// Found the closing label
FirstLevel = 0;
// Delete the row
LastRow = LastRow - 1;
// Delete the next row too
LastRow = LastRow - 1;
// We deleted this row so backup before moving to the next row
RowLocation = RowLocation - 1;
// Examine the next row
RowLocation = RowLocation + 1;
} while (RowLocation < LastRow);


Well, it is hard to write sample code using Aspose.Cells APIs that equally matches to your MS Excel automation code segments as we do not know certain objects/variables of MS Excel Interop. and data/contents in your template Excel file. As we told you to kindly go through Aspose.Cells APIs and Docs with examples for certain features, so kindly browse the Docs and examples for your reference and then write your sample code using Aspose.Cells APIs with respect to your existing samples.

Anyways, it looks like your code segment denotes to traverse a certain area or range of cells and then it deletes certain rows, etc. I will paste here a simple sample code snippet with comments for your reference:
Sample code:

//Open a template Excel file.
Workbook workbook = new Workbook(“e:\test\Book1.xlsx”);
//Get the first sheet (default).
Worksheet sheet = workbook.Worksheets[0];
//Get the cells in the worksheet.
Cells cells = sheet.Cells;

//Get the last cell in the second column (B)
Aspose.Cells.Cell endCell = cells.EndCellInColumn(1);
//Last row to loop through for B column
int maxrow = endCell.Row;

string val1;
for (int i = 0; i <= maxrow; i++)
val1 = cells[i, 3].StringValue;

//Your code goes here


Please also see the document on how to remove rows and columns in the worksheet for your reference:

If you still have any issue, kindly provide your template Excel file (input file) and your desired Excel file (which you may create in MS Excel manually), we will check and help you accordingly.

Thank you.

Thanks you so much for you reply.

Really appreciated !!

Is there any equivalent of Interior.Pattern.

can you convert below code into aspose cell.

Aspose.Cells.Style selection;

selection.Interior.Pattern = Constants.xlSolid;
selection.Interior.PatternColorIndex = Constants.xlAutomatic;
selection.Interior.TintAndShade = 0;
selection.Interior.ThemeColor = XlThemeColor.xlThemeColorLight1;
selection.Interior.color = 10027008;// here we can use selection.ForegroundColor()
selection.Interior.PatternTintAndShade = 0;

Thanks in advance !!


Please see the documents for your reference:

Hope, this helps a bit.

Thank you.

Thank you very much !!

It help me alot.
recently have purchased aspose cell licence.

any equivalent of fullRange.Range[“DataRow”].Row + 2;

Thanks in advance.


Thanks for considering Aspose.

Well, if you need to get/select the row index with respect to a cell which comes two rows after, you may try to use as following:
Sample code:

Cell cell = worksheet.Cells[“A1”];
int idxRow = cell.Row + 2;

And, to know about creating, accessing, manipulating named ranges and their cells, etc., see the documents:

Hope, this helps a bit.

Thank you.

Thanks for reply !!

My requirement is to access cell by custom name.
See attached screenshot.

Cell cell = worksheet.Cells[“DataRow”];

Thanks in advance


Please see the documents which I recommended you to check in my previous reply for your reference. In Aspose.Cells, if you need to access the named range, you will first get that range, then you will iterate into its cells area to get your desired cells and their values. One way to get the cell (first) of the range can be as following:
Sample code:

//Get range’s first cell.
Cell cell = workbook.Worksheets.GetRangeByName(“DataRow”)[0, 0];

Hope, this helps a bit.

Thank you.

It’s working !!

Thanks you so much for your help.


Good to know that your issue is sorted out now. Feel free to write back if you have further comments or questions, we will be happy to assist you soon.

Thank you.