The following code will pop up a "file open" dialog, but when you select
between different filters in the drop-down list, the list of available
files to choose from doesn't get updated. To get the list of files
updated, you need to go to a different directory and come back to the
one of interest. When you don't use the Excel constants, there is no
problem. This is as far as I can narrow down the problem.
#!perl
use Win32::OLE::Const 'Microsoft Excel';
use Win32::GUI;
# Create Main Window
my $Window = new Win32::GUI::Window (
-name => "Window",
-title=> "Title",
-pos => [100, 100],
-size => [400, 400],
) or die "new Window";
# Open a file
my $file = Win32::GUI::GetOpenFileName(
-owner => $Window,
-title => "Open a Perl file",
-filter => [ 'Perl script (*.pl)' => '*.pl',
'All files' => '*.*',
],
);
#...parse the file, make an Excel worksheet, etc...
I'm trying this on both XP Home & XP-Pro systems with Win32::GUI version
1.0 for Perl 5.8, and with ActiveState Perl version 5.8.6.811. Same
behaviour with 5.8.4.810. Help!
-Ed V.