Micro Focus QTP (UFT) Forums
Update a value in excel sheet during runtime & use the value later in the same script - 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: Update a value in excel sheet during runtime & use the value later in the same script (/Thread-Update-a-value-in-excel-sheet-during-runtime-use-the-value-later-in-the-same-script)



Update a value in excel sheet during runtime & use the value later in the same script - SweetyChowdhury - 09-05-2011

I am importing an excel sheet during runtime and updating a filed value and saving the excel sheet.Later in the same script, I am importing teh same sheet and using the updated value.

The issue is the excel sheet does nat have the upadted value during runtime(it is taking the earlier value already present). but when checked Opening the extenal sheet, it has the upadted value.

How to get the upadated value during runtime.

Please help on this.


RE: Update a value in excel sheet during runtime & use the value later in the same script - parminderdhiman84 - 09-05-2011

Hello,

Please share your code.

Regards,
Parminder


RE: Update a value in excel sheet during runtime & use the value later in the same script - gaveyom - 09-05-2011

Hi,

if possible can u share the code, so that i will check and update u


RE: Update a value in excel sheet during runtime & use the value later in the same script - souvikghosh_diatm - 09-08-2011

SUGGESTION
-------------------------------------------------------------
see, there may be two purpose of wat exactly u r trying to do....
1. just have to use the updated value later, dats y u r storing it...this is only for runtime use purpose...
2. Or u have to store d update value and have to save it in Excell dat u can see it after that run session too..may be this is d reason y u r storing it...

Now if ur requirement is d first one, then u can use store d update value in an Environment variable on runtime. If u do so, u can also be able to use dat updated value later on d same run session....


But if ur requirement is d 2nd one, then i will suggest::--- take d update value, store it in an environment variable and also write it in excel. whenever u need to use dat update value later, use d environment variable instead of importing d same excel again...
-----------------------------------------------------------------

SOLUTION

Now i'm coming to ur solution wat u have faced....as u hav mentioned, its clear dat u r importing same excel twice in a same run session...bt 2nd time u r not getting d updated value instead of saving it on 1st time...It may happen if u dnt release d excell from ur Local/Global sheet before 2nd time importing....1st u import-->Write on it-->Save it-->Release the excel by importing some other excel on Global/Local sheet-->then import d earlier excel again for 2nd time....If u do this, i think u'll cover-up ur problem.....Let me know d result....

------------------
Thanx.