[Wtr-general] problem in opening a file

Charley Baker charley.baker at gmail.com
Tue Aug 8 14:38:02 EDT 2006


Hi Vikash,

  You are several ways to do this depending on your particular needs, here's
one, add your data directory to your load path in the script you're using:
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'..','data')

This assumes your data directory is one up from the file you're trying to
access it from, change it if you're looking for something else, but this
should give you the basic idea.

-Charley


On 8/5/06, VIKASH KUMAR <vikashkumar051 at yahoo.co.in> wrote:
>
> I am loading a file by giving the absolute path, the below code works
> fine:
>
> excel = WIN32OLE::new('excel.Application')
>
> workbook = excel.Workbooks.Open('C:\demo\mation.xls')
>           worksheet = workbook.Worksheets(1)
>           worksheet.Select
>           excel['Visible'] = true
>
>
> *I want to use the name of the file to open 'mation.xls', not the entire
> path 'C:\demo\mation.xls'.*
> **
> *Please send me a solution for this.*
> **
> *Thanks in advance*
> **
> *Vikash Kumar*
>
>
> ------------------------------
> Here's a new way to find what you're looking for - Yahoo! Answers<http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060808/76e39fc4/attachment.html 


More information about the Wtr-general mailing list