Audrey
3 years agoOccasional Contributor
Insert picture in Excel
Hi, may i know how to insert picture in excel using keyword test? I notice there are limited operations for excel in keyword test
In your Project properties, add the WndClass name of the ribbon to MSAA in Open Applications. I’m using Excel 365 and my WndClass is called ‘NetUIHWND’. TestComplete will then recognise each of the menu items in the ribbon.
Record your keyword test as click Insert -> Pictures -> select file -> Insert
The same can be applied when scripting
function Test8()
{
Aliases.EXCEL.wndXLMAIN.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND.tablistRibbonTabs.ClickTab("Insert");
Aliases.EXCEL.wndXLMAIN.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND.paneLowerRibbon.client.propertypageInsert.toolbarIllustrations.buttonPictures.ClickButton();
Aliases.EXCEL.dlgInsertPicture.OpenFile("C:\\Users\\Test\\Pictures\\Smartbear.jpg", "All Pictures (*.emf;*.wmf;*.jpg;*.jpeg;*.jfif;*.jpe;*.png;*.bmp;*.dib;*.rle;*.gif;*.emz;*.wmz;*.tif;*.tiff;*.svg)");
}