Perl OLE Excel - edit width/height Comment window

S

Slickuser

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->{AddComment};
$Range_Enter->{Comment}->{Visible} = 0;
my $string = "".$Range_Enter->{Comment}->{Author}.":
\nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
\nwhat!!" ;
$Range_Enter->{Comment}->Text($string);

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

Brian Helterline

Slickuser said:
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->{AddComment};
$my $comment = $Range_Enter->{AddComment};
$Range_Enter->{Comment}->{Visible} = 0;
$comment->{Visible} = 1;
my $string = "".$Range_Enter->{Comment}->{Author}.":
\nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
\nwhat!!" ;

my $string = $comment->{Author} . ":.........";
$Range_Enter->{Comment}->Text($string); $comment->Text($string);


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

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

my $shape = $comment->{Shape}; # 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.
 
S

Slickuser

Thanks but my original question is still asking how to use selection
method with the ScaleWidth function call.

Slickuser said:
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->{AddComment};

$my $comment = $Range_Enter->{AddComment};
$Range_Enter->{Comment}->{Visible} = 0;

$comment->{Visible} = 1;
my $string = "".$Range_Enter->{Comment}->{Author}.":
\nHelllo \n\n\n\n\nwowow this is awesome!!!!!!!!!!!!
\nwhat!!" ;

my $string = $comment->{Author} . ":.........";
$Range_Enter->{Comment}->Text($string);
$comment->Text($string);



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

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

my $shape = $comment->{Shape}; # 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.
 
S

Slickuser

Selection was confusing.

But here is the correct code:

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

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

my $shape = $comment->{Shape};
$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 said:
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->{AddComment};
$my $comment = $Range_Enter->{AddComment};
$comment->{Visible} = 1;
my $string = $comment->{Author} . ":.........";
use constant msoFalse => 0; # or import the entire Office typelib
use constant msoScaleFromTopLeft => 0;
my $shape = $comment->{Shape}; # 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top