ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rotate a Shape (https://www.excelbanter.com/excel-programming/377317-rotate-shape.html)

CLR

Rotate a Shape
 
Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3





JLGWhiz

Rotate a Shape
 
I'm not sure if I really understand your query but my experience has been
that the rotation is relative to a point x number of pixels from the left
screen edge and y number of pixels from the top screen edge which the user
can set when using the AddShape method. If this is the zero base point you
refer to, it can be set by you when you add the shape in just about all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3





CLR

Rotate a Shape
 
Thanks, but all I know how to do is locate the upper left corner of the shape
when adding it to the sheet, and then of course incrementing a rotation by so
many degrees.....but I don't know how to establish an original base point of
rotation, or how to determine what the degree of rotation is now..........any
help would be much appreciated.

Vaya con Dios,
Chuck, CABGx3



"JLGWhiz" wrote:

I'm not sure if I really understand your query but my experience has been
that the rotation is relative to a point x number of pixels from the left
screen edge and y number of pixels from the top screen edge which the user
can set when using the AddShape method. If this is the zero base point you
refer to, it can be set by you when you add the shape in just about all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3





Peter T

Rotate a Shape
 
Is this what you're looking for

ngRot = Selection.ShapeRange.Rotation

Regards,
Peter T

"CLR" wrote in message
...
Thanks, but all I know how to do is locate the upper left corner of the

shape
when adding it to the sheet, and then of course incrementing a rotation by

so
many degrees.....but I don't know how to establish an original base point

of
rotation, or how to determine what the degree of rotation is

now..........any
help would be much appreciated.

Vaya con Dios,
Chuck, CABGx3



"JLGWhiz" wrote:

I'm not sure if I really understand your query but my experience has

been
that the rotation is relative to a point x number of pixels from the

left
screen edge and y number of pixels from the top screen edge which the

user
can set when using the AddShape method. If this is the zero base point

you
refer to, it can be set by you when you add the shape in just about all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the

Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that

base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3







JLGWhiz

Rotate a Shape
 
I was a little hasty in telling you that the point of rotation was to the
left, bottom for the increment.rotate method. That is for the flip and
characters.rotate methods.
Below is some code that you can run and see that the point of rotation is
approximately the center of the coordinates for the width and height of the
shape area. It is easier to see if you step through the procedure using
either F8 or with the mouse click the step icon on the tool bar in VBE.

Sub rotShpTst()
Worksheets(2).Shapes.AddShape_
msoShapeBentUpArrow, 350, 50, 150, 250
Worksheets(2).Shapes(1).Fill.ForeColor_
.RGB = RGB(255, 0, 0)
Counter = 0
Do

With Worksheets(2).Shapes(1)
.IncrementRotation 30
End With
Counter = Counter + 25
WaitTime
Loop While Counter < 100
Worksheets(2).Shapes(1).Delete
End Sub
Sub WaitTime()
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
sitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait sitTime
End Sub

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3





JLGWhiz

Rotate a Shape
 
Below is the basic method and sample code:

expression.AddShape(Type, Left, Top, Width, Height)
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

What the code does is to place the left edge of the rectangle (Shape) at 50
pixels from the left screen edge and the top edge of the rectangle 50 pixels
from the top screen edge while making the rectangle itself 100 by 200 pixels.
If you rotated the shape, the point of rotation would be the left, bottom
corner, but when you rotate it over 180 degrees clockwise, it will not get
closer than 50 pixels to the left screen edge.

Does this help?

"JLGWhiz" wrote:

I'm not sure if I really understand your query but my experience has been
that the rotation is relative to a point x number of pixels from the left
screen edge and y number of pixels from the top screen edge which the user
can set when using the AddShape method. If this is the zero base point you
refer to, it can be set by you when you add the shape in just about all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3





CLR

Rotate a Shape
 
Thank you very much kind Sir.........you hit the spot!

Vaya con Dios,
Chuck, CABGx3




"Peter T" <peter_t@discussions wrote in message
...
Is this what you're looking for

ngRot = Selection.ShapeRange.Rotation

Regards,
Peter T

"CLR" wrote in message
...
Thanks, but all I know how to do is locate the upper left corner of the

shape
when adding it to the sheet, and then of course incrementing a rotation

by
so
many degrees.....but I don't know how to establish an original base

point
of
rotation, or how to determine what the degree of rotation is

now..........any
help would be much appreciated.

Vaya con Dios,
Chuck, CABGx3



"JLGWhiz" wrote:

I'm not sure if I really understand your query but my experience has

been
that the rotation is relative to a point x number of pixels from the

left
screen edge and y number of pixels from the top screen edge which the

user
can set when using the AddShape method. If this is the zero base

point
you
refer to, it can be set by you when you add the shape in just about

all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so

many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the

Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from

that
base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3









CLR

Rotate a Shape
 
Thanks very much for coming back...........I appreciate your help, and do
believe I have a handle on it now.

Vaya con Dios,
Chuck, CABGx3


"JLGWhiz" wrote in message
...
Below is the basic method and sample code:

expression.AddShape(Type, Left, Top, Width, Height)
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

What the code does is to place the left edge of the rectangle (Shape) at

50
pixels from the left screen edge and the top edge of the rectangle 50

pixels
from the top screen edge while making the rectangle itself 100 by 200

pixels.
If you rotated the shape, the point of rotation would be the left, bottom
corner, but when you rotate it over 180 degrees clockwise, it will not get
closer than 50 pixels to the left screen edge.

Does this help?

"JLGWhiz" wrote:

I'm not sure if I really understand your query but my experience has

been
that the rotation is relative to a point x number of pixels from the

left
screen edge and y number of pixels from the top screen edge which the

user
can set when using the AddShape method. If this is the zero base point

you
refer to, it can be set by you when you add the shape in just about all
cases. This includes freeforms.

"CLR" wrote:

Hi All............
I know how to rotate a Shape from it's present orientation to so many
degrees of "increment"....this works fine for that

Sub Rotate15()
ActiveSheet.Shapes("Group 34").IncrementRotation 15.01
End Sub

What I need to know, is how to establish a base zero point for the

Shape,
and then have the macro rotate the Shape "TO" 15.01 degrees from that

base
point,, not just increment it from where it is now.....

TIA
Vaya con Dios,
Chuck, CABGx3








All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com