Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl OLE Excel - edit width/height Comment window

Reply
Thread Tools

Perl OLE Excel - edit width/height Comment window

 
 
Slickuser
Guest
Posts: n/a
 
      05-08-2008
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");
 
Reply With Quote
 
 
 
 
Brian Helterline
Guest
Posts: n/a
 
      05-08-2008
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->{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.

--
-brian
 
Reply With Quote
 
 
 
 
Slickuser
Guest
Posts: n/a
 
      05-09-2008
Thanks but my original question is still asking how to use selection
method with the ScaleWidth function call.

On May 8, 1:16 pm, Brian Helterline <(E-Mail Removed)> wrote:
> 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->{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.
>
> --
> -brian


 
Reply With Quote
 
Slickuser
Guest
Posts: n/a
 
      05-09-2008
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!
On May 9, 3:06 pm, Slickuser <(E-Mail Removed)> wrote:
> Thanks but my original question is still asking how to use selection
> method with the ScaleWidth function call.
>
> On May 8, 1:16 pm, Brian Helterline <(E-Mail Removed)> wrote:
>
> > 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->{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.

>
> > --
> > -brian


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
OLE & Excel - Opening causes Excel.exe to hang around TimmyD Perl Misc 0 04-21-2005 07:20 PM
Win32:OLE How to size or resize Excel comment textfield? Rodolfo Hinojosa~ Perl Misc 0 02-22-2005 04:34 PM
Win32::OLE Excel Chart SeriesCollection. Problem changing from Excel 2000 to 2002 moller@notvalid.se Perl Misc 1 07-05-2004 10:50 AM



Advertisments