Micro Focus QTP (UFT) Forums
How to create list in excel using qtp - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to create list in excel using qtp (/Thread-How-to-create-list-in-excel-using-qtp)



How to create list in excel using qtp - Charanpreet - 04-08-2011

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.


RE: How to create list in excel using qtp - Charanpreet - 04-11-2011

Any help will be appreciated. Thanks


RE: How to create list in excel using qtp - venkatbatchu - 04-12-2011

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


RE: How to create list in excel using qtp - Charanpreet - 04-12-2011

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.