Actually this method won't work. The problem is that File.join will join the elements using a forward slash (/). The pathname is being passed to Excel, which truly requires that backslashes be used in the filename. I've argued that this is a bug in Ruby, but there it is.
Bret LFIdnl wrote: > More useful > > File.join($drive,env,"Test_Results","#{$file_name}_Results.xls" ) > > On 17 дек, 00:20, "Darin Duphorn" <dduph...@redbrickhealth.com> wrote: > >> Try \\ >> >> $drive+"\\"+env+"\\Test_Results\\"+$file_name+"_Results.xls" >> >> -----Original Message----- >> From: watir-general@googlegroups.com >> >> [mailto:watir-gene...@googlegroups.com] On Behalf Of >> jas.shel...@hotmail.com >> Sent: Tuesday, December 16, 2008 3:08 PM >> To: Watir General >> Subject: [wtr-general] Opening an Excel file with a variable name >> >> All, >> >> I am attempting to open an Excel file with Ruby, and have run into a >> problem. If I open the file with single quotes, like inputFile = >> input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine. My >> problem now is that the location of the .xls file has a variable name, >> like inputFile = input.Workbooks.Open("C:\#{var)\sheet.xls"). When I >> try this, I get an error saying that the file cannot be found. It >> seems that the 'open' method will only work with single quotes, but to >> signify a variable in a string in Ruby you have to use double quotes. >> Has anyone discovered a way around this? Thanks in advance for any >> help. >> >> - Shelton >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---