VB to Perl Excel OLE question....QueryTables

G

gearoidterry

Hi,

I'm trying to convert this VB code:

ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\perl\2.csv", _
Destination:=Range("A1"))

into Perl and can't seem to get the syntax right. Can someone please
help me out? Here is what I have within Perl:

$xlBook->ActiveSheet->QueryTables->Add(Connection=>"TEXT;C:\perl\2.csv",
Destination=>Range("A1"));

I think the Connection parameter is Ok but the syntax on the
Destination parameter is definitely not correct.

Any advice is greatly appreciated.

Thanks,
Perl07.
 
M

Mark Clements

Hi,

I'm trying to convert this VB code:

ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\perl\2.csv", _
Destination:=Range("A1"))

into Perl and can't seem to get the syntax right. Can someone please
help me out? Here is what I have within Perl:

$xlBook->ActiveSheet->QueryTables->Add(Connection=>"TEXT;C:\perl\2.csv",
Destination=>Range("A1"));

I think the Connection parameter is Ok but the syntax on the
Destination parameter is definitely not correct.

Pass, but the "TEXT;C:\perl\2.csv" is suspect. You need to escape the
backslashes or use a non-interpolating quote operator, eg q()

mark@owl:~$ perl -le 'print q(TEXT;C:\perl\2.csv)'
TEXT;C:\perl\2.csv
mark@owl:~$ perl -le 'print "TEXT;C:\perl\2.csv"'
TEXT;C:perl.csv

See man perlop.

Mark
 
M

Mark Clements

Mark said:
Pass, but the "TEXT;C:\perl\2.csv" is suspect. You need to escape the
backslashes or use a non-interpolating quote operator, eg q()

mark@owl:~$ perl -le 'print q(TEXT;C:\perl\2.csv)'
TEXT;C:\perl\2.csv
mark@owl:~$ perl -le 'print "TEXT;C:\perl\2.csv"'
TEXT;C:perl.csv

See man perlop.
Come to think of it, you're clearly on Windows. You'll probably get more
mileage out of

perldoc perlop

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top