in reply to Win32 - M$ Outlook and Perl.
Updated.
Anytime I am trying to use perl and OLE to access M$ products, I start by creating a macro that does exactly what I want the perl program to do. Then I start translating the macro into perl. I've been considering creating a translator but I just never seem to have the time. Most of the work of translating it can be done with some regular expressions. It's the odd situations that the translator is actually required for.
For example, I wanted to setup my page for printing and I created a macro to do it. Here is a small snippet of that macro:
So I save that little snippet in a file called mymacro.txt. And then I run this code on it:With ActiveSheet.PageSetup .PrintTitleRows = "$1:$2" .PrintTitleColumns = "" .PrintArea = "$B:$I" End With
and the contents of mymacro.pl are:my $pl = ""; open(TXT, "<mymacro.txt"); while (<TXT>) { s/\./->/; s/=/=>/; s/"/'/g; s/\s+End With/);/; s/\s+With (\w+)->(\w+)/\$Range = \$$1->$2;\nwith (\$Range/i; s/(.*[^;])\n/$1,\n/; $pl .= $_; } close(TXT); open(TXT, ">mymacro.pl"); print TXT $pl; close(TXT);
Not all macros will translate this easily though.$Range = $ActiveSheet->PageSetup; with ($Range, PrintTitleRows => '$1:$2', PrintTitleColumns => '', PrintArea => '$B:$I', );
Matthew Musgrove
Who says that programmers can't work in the Marketing Department?
Or is that who says that Marketing people can't program?
|
---|
In Section
Seekers of Perl Wisdom