N
nicholastoze
Hi,
The following code only outputs 5 environment variables, not all of
the ones I can see from perl -le 'print "$_=$ENV{$_}" for keys %ENV'.
Is there a way to get all the environment variables in the VBA? I need
them so that an xll can find its license key file.
Thanks,
Nick
perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
uname -a
CYGWIN_NT-5.1 PC24 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Perl script:
#!/usr/bin/perl
use strict;
use Win32::OLE;
my $ex = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;});
$ex->Workbooks->Open("C:\\test.xls", 0, 1);
$ex->Run("printenv");
VBA in Excel file "C:\test.xls":
Option Explicit
Public Sub printenv()
Dim i As Long
Open "C:\excelenv.txt" For Output As #1
i = 1
Do While Environ(i) <> ""
Print #1, Environ(i)
i = i + 1
Loop
Close #1
End Sub
The following code only outputs 5 environment variables, not all of
the ones I can see from perl -le 'print "$_=$ENV{$_}" for keys %ENV'.
Is there a way to get all the environment variables in the VBA? I need
them so that an xll can find its license key file.
Thanks,
Nick
perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
uname -a
CYGWIN_NT-5.1 PC24 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Perl script:
#!/usr/bin/perl
use strict;
use Win32::OLE;
my $ex = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;});
$ex->Workbooks->Open("C:\\test.xls", 0, 1);
$ex->Run("printenv");
VBA in Excel file "C:\test.xls":
Option Explicit
Public Sub printenv()
Dim i As Long
Open "C:\excelenv.txt" For Output As #1
i = 1
Do While Environ(i) <> ""
Print #1, Environ(i)
i = i + 1
Loop
Close #1
End Sub