How to change the Year? - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: How to change the Year? (/Thread-How-to-change-the-Year) |
How to change the Year? - mv8167 - 09-17-2011 It must be a Friday meltdown-thing, but Happy Friday everyone What is the best way to change the current year? I need to subtract 3 or 10 years. I have: Code: intYear = Year(Now) Im on my way home. lol Would ths work? Code: intYear = year(Now.AddYears(-3)) RE: How to change the Year? - Shridevi.Salagare - 09-17-2011 year(now) - 3 .would work fine. RE: How to change the Year? - mv8167 - 09-19-2011 Thx Shridevi I am pretty sure I tried this already but the value would not be accepted in my drop down box. Maybe it was Friday brain issue and I had something else wrong. I will try again. ;-) RE: How to change the Year? - mv8167 - 09-19-2011 These work fine: Code: intYear = Year(Now) '=2011 This works" Code: 'Browser("Preferences").Page("Preferences").WebList("Select_Tax_Year").Select "2001" But these dont: Code: With Browser("Preferences").Page("Preferences") nor these: Code: .WebList("Select_Tax_Year").Select (Year(Now) - 3) '"2008" Can I use a variable to select a drop down's list value? RE: How to change the Year? - vIns - 09-20-2011 I am not sure ...i think the value should be a string. can u try this Code: .WebList("Select_Tax_Year").Select CStr(Year(Now) - 3) RE: How to change the Year? - mv8167 - 09-20-2011 VIns That did the trick. I have never used CStr but I will now. Thx! For those who are interested: These: Code: intYear = Year(Now) The "2008" and "2001" with quotes is what I need to change a combo box. thx Lorena How about the Month? I have: Code: intMonth = Month(Now) How do I change the "8" or 8 to "August"? I figured it out, nvr mind. Code: intMonth = Month(Now) |