I get a file name in the directory and modify the cells with making
bold etc.
when excel.visible=TRUE it works. However, when excel.visible=FALSE
nothing happens.
Why?
I get a file name in the directory and modify the cells with making
bold etc.
when excel.visible=TRUE it works. However, when excel.visible=FALSE
nothing happens.
Why?
...
Tried your code and it seems that 'Save as...' is putting the saved
file into 'My Documents' rather than overwriting the original (which is
in the same dir as where I saved your code into a file).
I get a file name in the directory and modify the cells with making
bold etc.
when excel.visible=TRUE it works. However, when excel.visible=FALSE
nothing happens.
Why?
newdir=Dir.getwd
}
excel.quit()
This will look more like Ruby is you don't type the parentheses, and
it's less typing.
Speaking of Excel, I mostly use spreadsheet and parseexcel, which are
both available here:
And BTW, you might consider putting your code in a begin ... rescue ...
ensure ... end block and, well, ensure that excel it actually quit.
Otherwise you might (will) end up with 'dangling' excel instances if (or
when) the code raises an exception.
If/when that happens, you have to quit the dangling Excel app. from the
task manager before you can run your program again (well without
problems, that is).
This happened every now and then on a Windows (2K) machine until I made
sure that excel.quit is actually executed in case of an error.
Anyway, I think the above mentioned modules are easier to use and understand than using OLE automation. And the code also look a lot more like Ruby.
I have run into trouble in the past using relative pathnames for MS
Office files (open, saving). Try using an absolute pathname when you
(a) open the file and (b) save the file. That should put it in the
correct location.
Blessings,
TwP
···
On 12/15/06, ChrisH <chris.hulan@gmail.com> wrote:
anon1m0us wrote:
> I get a file name in the directory and modify the cells with making
> bold etc.
> when excel.visible=TRUE it works. However, when excel.visible=FALSE
> nothing happens.
> Why?
...
Tried your code and it seems that 'Save as...' is putting the saved
file into 'My Documents' rather than overwriting the original (which is
in the same dir as where I saved your code into a file).
The 2 working ways I've found to open/save files look like this:
x.workbooks.open(Dir.getwd + "/file.xls") # Note the / before the file name
or
x.workbooks.open("C:\\ruby\\files\\spreadheets\\file.xls") # Note the
escaped \'s
So you'll probably be able to use something like that.
Thanks,
Nate
···
On 12/15/06, Tim Pease <tim.pease@gmail.com> wrote:
On 12/15/06, ChrisH <chris.hulan@gmail.com> wrote:
>
> anon1m0us wrote:
> > I get a file name in the directory and modify the cells with making
> > bold etc.
> > when excel.visible=TRUE it works. However, when excel.visible=FALSE
> > nothing happens.
> > Why?
> ...
>
> Tried your code and it seems that 'Save as...' is putting the saved
> file into 'My Documents' rather than overwriting the original (which is
> in the same dir as where I saved your code into a file).
>
I have run into trouble in the past using relative pathnames for MS
Office files (open, saving). Try using an absolute pathname when you
(a) open the file and (b) save the file. That should put it in the
correct location.
The main issue is still unresolved....why when I have the excel not
visible NOTHING happens. Only when i make excel =true(visable) then
everyting occurs?
Stephan Kämper wrote:
···
Li Chen wrote:
> Stephan Kämper wrote:
>
>> Speaking of Excel, I mostly use spreadsheet and parseexcel, which are
>> both available here:
>>
>> http://rubyforge.org/frs/?group_id=678&release_id=6674
>
> Is it possible to draw graphics with it in Excel?
>
The main issue is still unresolved....why when I have the excel not
visible NOTHING happens. Only when i make excel =true(visable) then
everyting occurs?
Stephan Kämper wrote:
···
Li Chen wrote:
> Stephan Kämper wrote:
>
>> Speaking of Excel, I mostly use spreadsheet and parseexcel, which are
>> both available here:
>>
>> http://rubyforge.org/frs/?group_id=678&release_id=6674
>
> Is it possible to draw graphics with it in Excel?
>