ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C# Interop Shape xlMoveAndSize property doesn't stick (https://www.excelbanter.com/excel-programming/399018-c-interop-shape-xlmoveandsize-property-doesnt-stick.html)

BIG_j

C# Interop Shape xlMoveAndSize property doesn't stick
 
I create a shape and set the Placement as follows...

Excel.Shape myPicture = _ActiveSheet.Shapes.AddPicture(Location,
MsoTriState.msoFalse, MsoTriState.msoTrue, TargetLeft, TargetTop,
TargetWidth, TargetHeight);

myPicture.Placement = Excel.XlPlacement.xlMoveAndSize;

Problem is, the xlPlacement will not stick. The property remains as xlMove.
Even trying to force a change in the watch window deson't work.

Anyone knows what's going on (or whats wrong) here?

Thanks

BIG_j





BIG_j

C# Interop Shape xlMoveAndSize property doesn't stick
 
More Information, if it helps...

This only happens when the "Shape" is not a standard in-built Excel Shape


"BIG_j" wrote in message
...
I create a shape and set the Placement as follows...

Excel.Shape myPicture = _ActiveSheet.Shapes.AddPicture(Location,
MsoTriState.msoFalse, MsoTriState.msoTrue, TargetLeft, TargetTop,
TargetWidth, TargetHeight);

myPicture.Placement = Excel.XlPlacement.xlMoveAndSize;

Problem is, the xlPlacement will not stick. The property remains as
xlMove. Even trying to force a change in the watch window deson't work.

Anyone knows what's going on (or whats wrong) here?

Thanks

BIG_j







Peter T

C# Interop Shape xlMoveAndSize property doesn't stick
 
In what way is 'ActiveSheet.Shapes.AddPicture(etc..' not a standard shape

Can you change the property manually, if so try changing
myPicture.Placement = Excel.XlPlacement.xlMoveAndSize;

to
myPicture.Placement = 1;

though not sure why that would fix if as you say xlMoveAndSize is found in
the library and works with a 'normal' shape.

Regards,
Peter T


"BIG_j" wrote in message
...
More Information, if it helps...

This only happens when the "Shape" is not a standard in-built Excel Shape


"BIG_j" wrote in message
...
I create a shape and set the Placement as follows...

Excel.Shape myPicture = _ActiveSheet.Shapes.AddPicture(Location,
MsoTriState.msoFalse, MsoTriState.msoTrue, TargetLeft, TargetTop,
TargetWidth, TargetHeight);

myPicture.Placement = Excel.XlPlacement.xlMoveAndSize;

Problem is, the xlPlacement will not stick. The property remains as
xlMove. Even trying to force a change in the watch window deson't work.

Anyone knows what's going on (or whats wrong) here?

Thanks

BIG_j










All times are GMT +1. The time now is 01:09 AM.

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