Hi
I have two queries in the below codes.
Query 1: How to involve the xlswrite command in actxserver.
FYI: Names{gp} --> Heading name to be placed in excel sheet from A1.
data_peak{gp} --> data to be placed in excel sheet from A2.
gp --> used to work in for loop.
Somehow i made with xlswrite through conventional method and autofit the columns thorugh actxserver. But the time will be saved if xlswrite command also to be invloved in the actxserver itself.
Query 2: When i used to close the workbook using hWorkbook.Close command, the script gets hanged and it doesn't go to the next line. I dont know th reason why it is hanged and it doesnot show any warning or error.
xlswrite(fullFileName,T,Names{gp},'A1');
xlswrite(fullFileName,data_peak{gp},Names{gp},'A2');
hExcel = actxserver('Excel.Application');
hWorkbook = hExcel.Workbooks.Open(fullFileName);
hExcel.Cells.Select;
hExcel.Cells.EntireColumn.AutoFit;
hExcel.Selection.HorizontalAlignment = 3;
hExcel.Selection.VerticalAlignment = 2;
hExcel.Range('A1').Select;
hWorkbook.Save
try
sheetName = 'Sheet';
hExcel.ActiveWorkbook.Worksheets.Item([sheetName '1']).Delete;
catch ME
end
hWorkbook.Close
hExcel.Quit
hExcel.delete
clear hExcel
Kindly provide me some ideas to get rid of these two issues and let me know if you need any further information.
Thanks in advance.