in reply to (Guildenstern) Re: Win32::OLE and Excel
in thread Win32::OLE and Excel

Yeah, the simple solution will be to write only one output file... My problems, too, arose when I tried to have two books or more books under one instance of Excel... Sigh.
  • Comment on RE: (Guildenstern) Re: Win32::OLE and Excel

Replies are listed 'Best First'.
(Guildenstern) REx2: Win32::OLE and Excel
by Guildenstern (Deacon) on Sep 18, 2000 at 20:54 UTC
    Maybe you need to add an explicit Close that does the same thing as DESTROY. That way you could have one at a time open, which might avoid problems. As an example, I changed your test code to this:
    use Excel; { my $s = Excel->new("here.xls"); $s->print("one", "Hello World\nThis\tis\ta\ttest\n"); $s->print("one", join("\t", 1 ..10)); $s->print("one", "bye\n"); $s->print("one", join("\n",3 .. 5) . scalar(localtime)); $s->print("two", join("\n",13 .. 25) . scalar(localtime)); $s->print("eight", join("\n",13 .. 20) . scalar(localtime)); } { my $t = Excel->new("c:/temp/there.xls"); $t->print("two", join("\n",13 .. 25) . scalar(localtime)); }
    and it worked perfectly. (Notice the braces around the two sections.) Putting the sections in blocks like that forces DESTROY to be called before the next new is called.

    Guildenstern
    Negaterd character class uber alles!