Micro Focus QTP (UFT) Forums

Full Version: How to create list in excel using qtp
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
AM using following code snippet
Code:
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="a,b,c"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
But am getting error Expression expected on line 2 ie is on Add Type. But after removing ":" no error is displayed. But while execution runtime error is occuirng which says: Syntax error.
Will appreciate the response on this.
Thanks.
Any help will be appreciated. Thanks
Hi charan,

As per my understand,

I understood that you are looking for filter option in excel (List as per you terminology).

Code:
set objExcel=Createobject("Excel.Application")
set objWorkbook=objExcel.Workbooks.open("D:\venkat.xls")
set objworksheet=objExcel.worksheets("sheet1")
objworksheet.cells(1,1).autofilter
objworksheet.cells(1,1).autofilter 1,"99"   'It will filter the values w.r.t 99
objworksheet.cells(1,1).autofilter 2,"batchu"
objworksheet.cells(1,1).autofilter 1,"2"
set objExcel=Nothing
set objWorkbook=Nothing
set objworksheet=Nothing


Regards,
Venkat.Batchu
Hi Venkat,
Thanks for your reply. But I am not looking for autofilter. Actually I am looking for combobox(listbox) creation through QTP VB code in Excel sheet. I am capturing data through front end screen from combobox and I want to save same comboox data in a cell in Excel sheet through VB coding. Any help in this regard is appreciable.
Thanks.