|
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
|