Variant Excel,Workbooks, Workbook;
Variant Worksheets,Worksheet, Range, Cell, FColumns, Format, Item;
Excel = CreateOleObject ( "Excel.Application");
Excel.OlePropertySet("Visible", true );
Workbooks=Excel.OlePropertyGet("Workbooks");
Workbook=Workbooks.OleFunction("Add");
Worksheets=Workbook.OlePropertyGet("Worksheets");
Worksheet=Worksheets.OlePropertyGet("Item", 1);
Its working well as a stand alone program. But i include the same code in the button of my project I got this error in run time:
Access violation at address 0053A08B in module 'Project1.exe'.Read of address 00000800
How to rectify this problem. give me the solution.