Variant ex,wb,sheet,range;
ex=CreateOleObject("Excel.Application");//创建应用对象
ex.OlePropertySet("Visible",true);//显示excel
ex.OlePropertyGet("Workbooks").OleProcedure("Add"); // 工作表
wb=ex.OlePropertyGet("ActiveWorkBook");//创建工作簿对象
sheet=wb.OlePropertyGet("ActiveSheet");
1、增加 sheet:
wb.OlePropertyGet("Sheets").OleFunction("Add", "Sheet4");
2、sheet 重新命名:
由于:sheet 的名称获取采用 sheet.OlePropertyGet("Name");
因此:sheet 的名称设置采用 sheet.OlePropertySet("Name", "优化前的电压");
ex=CreateOleObject("Excel.Application");//创建应用对象
ex.OlePropertySet("Visible",true);//显示excel
ex.OlePropertyGet("Workbooks").OleProcedure("Add"); // 工作表
wb=ex.OlePropertyGet("ActiveWorkBook");//创建工作簿对象
sheet=wb.OlePropertyGet("ActiveSheet");
1、增加 sheet:
wb.OlePropertyGet("Sheets").OleFunction("Add", "Sheet4");
2、sheet 重新命名:
由于:sheet 的名称获取采用 sheet.OlePropertyGet("Name");
因此:sheet 的名称设置采用 sheet.OlePropertySet("Name", "优化前的电压");