I have a Perl program which writes some data into an Excel spreadsheet and does some formatting. I had some code in it to scale the spreadsheet using the PageSetup "adjust to percentage" which I needed to modify to use the "fit to pages" function instead. The VBA macro which I generated to see what code was needed indicated that I needed to set the "Zoom" property to "False". The original Perl code I tried was something like:
which gave me an Exception error and didn't work. So I tried setting the value to zero. Same error. Setting the zoom value to a numeric value worked correctly so I knew the rest of the syntax was correct.
The frequently referred to "Using Win32::OLE and Excel - Tips and Tricks" document posted here indicated that the code needed to look like this:
my $vtfalse = Variant(VT_BOOL,0);
I find this really bizarre. What is the difference between setting the value to zero or "false" and setting it using the variant value? I realize this is only partially a Perl question as it seems the apparent absurity is in the way Microsoft has "designed" the Office object package but I would appreciate any help anyone might be able to offer in understanding this.