Forum Discussion

nastester's avatar
nastester
Regular Contributor
3 years ago
Solved

Setting Excel filename as project variable

Is there a way to set an Excel filename as a variable or something so if it changes name/location I can just update it once in one place?

 

I have a bunch of 'Excel- Read Value" operations in my keyword tests that point to an excel workbook on a network drive.  

They all point to different cells within that workbook but have the same file name. 

 

If the filename changes or moves, I would have to update each operation in every test instead of just updating one time.

Is this possible? 

  • Hi Jonathon


    Do You want to delay "start recording action" when You click "Record new test" button?


    What You can do (if I understand you well) is:


    1) Open Tools -> Options -> Engines -> Recording -> Automaticly add applications to the Tested Applications list -> disable this option


    2) Open Tools -> Current Project Properties -> General -> Record user actions over tested applications only -> enable it


    With this two options TC will only generate script when You are on specific application (the one you have in Tested App).


    Hope this help You.

6 Replies

  • Sure! Make it as a string variable

     

    myexcelvariable = "c:\myexceldirectory\myexcelworkbook.xls"

     

    then choose that variable any place you need the file name

     

    If you need to combine it with another string, you would use it in a code expression similar to this

     

     

     

     

     

    • nastester's avatar
      nastester
      Regular Contributor

      Hi Marsha,

      When trying that, I am getting an exception saying file is not found.

      See screenshots.