Editing Excel files
Hi there,
Was wondering if there was an easier way to edit the content of an excel file? More specifically, is there a way i can reference specific cells?
I have a file that i use to validate test results. This file has variable content dependant on what the value of a certain cells is. I would like to make the updating of this file an automated process instead of having to manually open the file edit the value and close it, due to the size of the file this is a very time consuming process.
At the moment i have done it through a very ugly hack, that is easily broken.
function ChangeCommStructure(Sender)
{
var CommStruct = UserForms.Main.CommStructure.ItemIndex+1;
var file = UserForms.Main.FilePath.Lines.Text+"[Enter]";
var explorer;
var excel;
var xldesk;
var wndAU_Comm;
var toolbarWindow32;
Sys.Keys("[Hold][Win]r[Release]"+file);
Sys.WaitProcess("EXCEL", 15000, 1);
excel = Sys.Process("EXCEL");
xldesk = excel.Window("XLMAIN", "*").Window("XLDESK");
wndAU_Comm = xldesk.Window("EXCEL7", "AU_Comm");
wndAU_Comm.Keys("^[Home]");
wndAU_Comm.Keys("[Right][Right][Right][Right][Right][Right]");
wndAU_Comm.Keys("[Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down][Down]");
wndAU_Comm.Keys(CommStruct)
xldesk.Window("EXCEL6").Keys("[Enter]");
Delay(1500);
wndAU_Comm.Keys("~[F4]");
Delay(1500);
excel.Window("#32770", "Microsoft Office Excel").Window("Button", "&Yes").Keys("[Enter]");
}
Additionally is there a way i can import this excel file into test complete as a table or DB rather than using the DDT.ExcelDriver method? Or is this even a worth while change?
Thanks,
Brad