Forum Discussion
Ryan_Moran
10 years agoValued Contributor
Hi dhirendranaga,
There are several ways to do this.
Two examples would be to create an ADO connection to the excel sheet and insert a record, or use TestComplete to paste the data into the first column. To access the clipboard contents use Sys.Clipboard.
- dhirendranaga10 years agoOccasional Contributor
Hi,
Can you please provide some sample code as how to paste code from Sys.ClipBoard to excel first sheet first cell.
Would be of great help please.
Dhirendra.
- altemann10 years agoContributor
Hey dhirendranaga!
This should work:
function InsertTextExcel() { var excel = Sys.OleObject("Excel.Application"); excel.DisplayAlerts = false; //No messages var book = app.Workbooks.Open("C:\\TC\\ArquivoEXCEL"); //Path to your excel file var sheet = book.Sheets("Plan1"); //Name of the sheet sheet.Cells(1, 1) = Sys.Clipboard; book.Save(); app.Quit(); }