Please find the below to retrive data and formula using vba
Rem Create file system object
Set oExcel = CreateObject("Excel.application")
Rem add workbook
oExcel.Workbooks.add
Rem oExcel.Application.Visible = true
Set oSheet = oExcel.ActiveWorkbook.Worksheets("Sheet1")
Rem Add values and formula
oSheet.Cells(1,1).value="1"
oSheet.Cells(2,1).value="1"
oSheet.Cells(3,1).formula="=SUM(A1,A2)"
Rem save excel in sepcific folder path
oExcel.ActiveWorkbook.SaveAs "Folder path"
Rem retrive formula data
msgbox oSheet.Cells(3,1).formula
oExcel.quitOn Sun, Jan 26, 2014 at 5:36 AM, QTP Tutorialnet <[email protected]>wrote: > Nishant, try datatable.import for that spreadsheet. See what values you > get in the data table... > Let me know if you are able to see values or formulas... > > > On Saturday, January 25, 2014 2:59:47 AM UTC-5, Nishant Pawar wrote: > >> Hi, >> >> I can not understand what problem you guys are facing. >> >> I am also trying to get the value of cell A(1,1) of excel and the value >> of cell A(1,1) is being calculated by formula "=(B2+C2)" >> >> Per my understanding you want to access the value of cell and not the >> formula which is being applied in that cell.. >> When I access the cell A(1,1) using vbscript then it is returning me the >> value and not the formula which is absolutely fine I guess. >> Please find below screenshot. >> >> [image: Inline image 1] >> >> [image: Inline image 3] >> >> Please let me know if I am unable to get your question. >> >> Thanks, >> Nishant >> >> >> >> >> >> On Fri, Jan 24, 2014 at 8:02 AM, Nik <[email protected]> wrote: >> >>> Francois, I think I understand your issue. You need to import the >>> valuees of excel instead of the formulas? Unfortunately, I do not think >>> that there is an easy solution. I know i tried it and was not able to do so >>> directly. But in the qtp world, there is always a solution. May I ask why >>> you want to import this data? What domyou intend to use it for? I would >>> recommend using an excel object to do a paste special of only values after >>> you copy them. So copy all cells, paste special in a new sheet with only >>> values, then import those values. Bit of a pain, but I havent seen better >>> solutions out there. >>> www.qtptutorial.net >>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google >>> "QTP - HP Quick Test Professional - Automated Software Testing" >>> group. >>> To post to this group, send email to [email protected] >>> >>> To unsubscribe from this group, send email to >>> [email protected] >>> >>> For more options, visit this group at >>> http://groups.google.com/group/MercuryQTP?hl=en >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "QTP - HP Quick Test Professional - Automated Software >>> Testing" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>> topic/mercuryqtp/pL_6oyufO5E/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> Regards, >> Nishant Pawar. >> > -- > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "QTP - HP Quick Test Professional - Automated Software Testing" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
