Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries

Links

XODOX
Impressum

#1: How to make COPY of Worksheet(1) to some other Worksheet ???

Posted on 2008-01-12 22:09:27 by Katja

How to make COPY of Worksheet(1)to some other Worksheet ???

Please Help!


------------------
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...
# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');
my $Book = $Excel->Workbooks->Open('d:\cgi\work.xls');
my $Sheet = $Book->Worksheets(1);

# How to make COPY of Worksheet(1) to some other Worksheet ???
#

$Book->Save;
------------------

Report this message

#2: Re: How to make COPY of Worksheet(1) to some other Worksheet ???

Posted on 2008-01-14 11:26:23 by andygpeters

On Jan 12, 9:09=A0pm, "Katja" <ka...@makniovotht.hr> wrote:
> How to make COPY of Worksheet(1)to some other Worksheet ???
>
> Please Help!
>
> ------------------
> use strict;
> use Win32::OLE qw(in with);
> use Win32::OLE::Const 'Microsoft Excel';
> $Win32::OLE::Warn =3D 3; # die on errors...
> # get already active Excel application or open new
> my $Excel =3D Win32::OLE->GetActiveObject('Excel.Application')
> || Win32::OLE->new('Excel.Application', 'Quit');
> my $Book =3D $Excel->Workbooks->Open('d:\cgi\work.xls');
> my $Sheet =3D $Book->Worksheets(1);
>
> # How to make COPY of Worksheet(1) to some other Worksheet ???
> #
>
> $Book->Save;
> ------------------

I normally record a macro and use what's been generated.
In your case this gives

Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=3DSheets(2)

Which translates to something like

$Sheet->Select;
$Sheet->Copy( 'Before' =3D> $Book->Worksheets(2));

Hope this helps.

Report this message