Click here to get back home

Perl OLE Excel - edit width/height Comment window

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Perl OLE Excel - edit width/height Comment window Slickuser 05-08-2008
Get Chitika Premium
Posted by Slickuser on May 8, 2008, 1:32 pm
Please log in for more thread options
I have achieved adding comments but I can't change the width and
height of the comment box. Any help?

This is the VBA macro code:
Range("C23").Comment.Text Text:= _
"Slickuser:" & Chr(10) & "Helllo " & Chr(10) & ""
& Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "wowow this
is awesome!!!!!!!!!!!! " & Chr(10) & "what!!"
Selection.ShapeRange.ScaleWidth 1.76, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.54, msoFalse,
msoScaleFromTopLeft
Range("C23").Comment.Shape.Select True
ActiveWindow.SmallScroll Down:=6
Range("F19").Select


Perl OLE Browser info:

Comment: Property Shape As Shape readonly
ShapeRange: Sub ScaleHeight(Factor As VT_R4, RelativeToOriginalSize As
MsoTriState, [Scale])


Here is the Perl code:

$Range_Enter = $Worksheet->Range("C23");

$Range_Enter->;
$Range_Enter->-> = 0;
my $string = "".$Range_Enter->->.":
\nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
\nwhat!!" ;
$Range_Enter->->Text($string);

//not sure how to translate this with Selection
#$Range_Enter>->ScaleWidth("1.76, msoFalse,
msoScaleFromTopLeft");
#$Range_Enter->->ScaleHeight("0.54, msoFalse,
msoScaleFromTopLeft");

Posted by Brian Helterline on May 8, 2008, 4:16 pm
Please log in for more thread options
Slickuser wrote:
> I have achieved adding comments but I can't change the width and
> height of the comment box. Any help?
>
> This is the VBA macro code:
> Range("C23").Comment.Text Text:= _
> "Slickuser:" & Chr(10) & "Helllo " & Chr(10) & ""
> & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "wowow this
> is awesome!!!!!!!!!!!! " & Chr(10) & "what!!"
> Selection.ShapeRange.ScaleWidth 1.76, msoFalse,
> msoScaleFromTopLeft
> Selection.ShapeRange.ScaleHeight 0.54, msoFalse,
> msoScaleFromTopLeft
> Range("C23").Comment.Shape.Select True
> ActiveWindow.SmallScroll Down:=6
> Range("F19").Select
>
>
> Perl OLE Browser info:
>
> Comment: Property Shape As Shape readonly
> ShapeRange: Sub ScaleHeight(Factor As VT_R4, RelativeToOriginalSize As
> MsoTriState, [Scale])
>
>
> Here is the Perl code:
>
> $Range_Enter = $Worksheet->Range("C23");
>
> $Range_Enter->;
$my $comment = $Range_Enter->;

> $Range_Enter->-> = 0;
$comment-> = 1;

> my $string = "".$Range_Enter->->.":
> \nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
> \nwhat!!" ;

my $string = $comment-> . ":.........";

> $Range_Enter->->Text($string);
$comment->Text($string);

>
> //not sure how to translate this with Selection
> #$Range_Enter>->ScaleWidth("1.76, msoFalse, msoScaleFromTopLeft");
> #$Range_Enter->->ScaleHeight("0.54, msoFalse,
msoScaleFromTopLeft");

use constant msoFalse => 0;        # or import the entire Office typelib
use constant msoScaleFromTopLeft => 0;

my $shape = $comment->;        # now you have your shape object
$shape->ScaleWidth( 1.76, msoFalse, msoScaleFromTopLeft );
$shape->ScaleHeight(0.54, msoFalse, msoScaleFromTopLeft );


In your excel macro, the ScaleWidth and ScaleHeight functions were
called on the current selection, you need to make get that "selection"
in perl before you can operate on it.

--
-brian

Posted by Slickuser on May 9, 2008, 6:06 pm
Please log in for more thread options
Thanks but my original question is still asking how to use selection
method with the ScaleWidth function call.

> Slickuser wrote:
> > I have achieved adding comments but I can't change the width and
> > height of the comment box. Any help?
>
> > This is the VBA macro code:
> > Range("C23").Comment.Text Text:= _
> > "Slickuser:" & Chr(10) & "Helllo " & Chr(10) & ""
> > & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "wowow this
> > is awesome!!!!!!!!!!!! " & Chr(10) & "what!!"
> > Selection.ShapeRange.ScaleWidth 1.76, msoFalse,
> > msoScaleFromTopLeft
> > Selection.ShapeRange.ScaleHeight 0.54, msoFalse,
> > msoScaleFromTopLeft
> > Range("C23").Comment.Shape.Select True
> > ActiveWindow.SmallScroll Down:=6
> > Range("F19").Select
>
> > Perl OLE Browser info:
>
> > Comment: Property Shape As Shape readonly
> > ShapeRange: Sub ScaleHeight(Factor As VT_R4, RelativeToOriginalSize As
> > MsoTriState, [Scale])
>
> > Here is the Perl code:
>
> > $Range_Enter = $Worksheet->Range("C23");
>
> > $Range_Enter->;
>
> $my $comment = $Range_Enter->;
>
> > $Range_Enter->-> = 0;
>
> $comment-> = 1;
>
> > my $string = "".$Range_Enter->->.":
> > \nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
> > \nwhat!!" ;
>
> my $string = $comment-> . ":.........";
>
> > $Range_Enter->->Text($string);
>
> $comment->Text($string);
>
>
>
> > //not sure how to translate this with Selection
> > #$Range_Enter>->ScaleWidth("1.76, msoFalse,
msoScaleFromTopLeft");
> > #$Range_Enter->->ScaleHeight("0.54, msoFalse,
msoScaleFromTopLeft");
>
> use constant msoFalse => 0; # or import the entire Office typelib
> use constant msoScaleFromTopLeft => 0;
>
> my $shape = $comment->; # now you have your shape object
> $shape->ScaleWidth( 1.76, msoFalse, msoScaleFromTopLeft );
> $shape->ScaleHeight(0.54, msoFalse, msoScaleFromTopLeft );
>
> In your excel macro, the ScaleWidth and ScaleHeight functions were
> called on the current selection, you need to make get that "selection"
> in perl before you can operate on it.
>
> --
> -brian


Posted by Slickuser on May 9, 2008, 6:19 pm
Please log in for more thread options
Selection was confusing.

But here is the correct code:

$Range_Enter = $Worksheet->Range("C23");

my $comment = $Range_Enter->;
$comment-> = 1;
my $string = $comment-> . ":\nHelllo \n\n\n\n
\nwowow this is awesome!!!!!!!!!!!! \nwhat!!";
$comment->Text($string);

my $shape = $comment->;
$shape->Select;
$shape->ScaleWidth( 1.75, msoFalse, msoScaleFromTopLeft);
$shape->ScaleHeight(2, msoFalse, msoScaleFromTopLeft);

Thanks for the help Brian!
> Thanks but my original question is still asking how to use selection
> method with the ScaleWidth function call.
>
>
> > Slickuser wrote:
> > > I have achieved adding comments but I can't change the width and
> > > height of the comment box. Any help?
>
> > > This is the VBA macro code:
> > > Range("C23").Comment.Text Text:= _
> > > "Slickuser:" & Chr(10) & "Helllo " & Chr(10) & ""
> > > & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "wowow this
> > > is awesome!!!!!!!!!!!! " & Chr(10) & "what!!"
> > > Selection.ShapeRange.ScaleWidth 1.76, msoFalse,
> > > msoScaleFromTopLeft
> > > Selection.ShapeRange.ScaleHeight 0.54, msoFalse,
> > > msoScaleFromTopLeft
> > > Range("C23").Comment.Shape.Select True
> > > ActiveWindow.SmallScroll Down:=6
> > > Range("F19").Select
>
> > > Perl OLE Browser info:
>
> > > Comment: Property Shape As Shape readonly
> > > ShapeRange: Sub ScaleHeight(Factor As VT_R4, RelativeToOriginalSize As
> > > MsoTriState, [Scale])
>
> > > Here is the Perl code:
>
> > > $Range_Enter = $Worksheet->Range("C23");
>
> > > $Range_Enter->;
>
> > $my $comment = $Range_Enter->;
>
> > > $Range_Enter->-> = 0;
>
> > $comment-> = 1;
>
> > > my $string = "".$Range_Enter->->.":
> > > \nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
> > > \nwhat!!" ;
>
> > my $string = $comment-> . ":.........";
>
> > > $Range_Enter->->Text($string);
>
> > $comment->Text($string);
>
> > > //not sure how to translate this with Selection
> > > #$Range_Enter>->ScaleWidth("1.76, msoFalse,
msoScaleFromTopLeft");
> > > #$Range_Enter->->ScaleHeight("0.54, msoFalse,
msoScaleFromTopLeft");
>
> > use constant msoFalse => 0; # or import the entire Office typelib
> > use constant msoScaleFromTopLeft => 0;
>
> > my $shape = $comment->; # now you have your shape object
> > $shape->ScaleWidth( 1.76, msoFalse, msoScaleFromTopLeft );
> > $shape->ScaleHeight(0.54, msoFalse, msoScaleFromTopLeft );
>
> > In your excel macro, the ScaleWidth and ScaleHeight functions were
> > called on the current selection, you need to make get that "selection"
> > in perl before you can operate on it.
>
> > --
> > -brian


Similar ThreadsPosted
Win32:OLE How to size or resize Excel comment textfield? February 22, 2005, 10:34 am
adding an excel worksheet to a generetad excel file via perl April 17, 2007, 8:38 am
OT: Anybody using Xemacs to edit Perl Code? June 13, 2006, 4:41 am
FAQ: How do I edit my .htpasswd and .htgroup files with Perl? October 10, 2004, 11:10 am
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? March 25, 2005, 12:03 am
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? May 26, 2005, 5:03 pm
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? September 9, 2005, 10:03 am
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? October 30, 2005, 5:03 pm
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? November 23, 2005, 11:03 am
FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl? September 23, 2006, 3:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap