Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rotaing pictures in excel

Status
Not open for further replies.

iken

Mechanical
May 13, 2003
151
Can anyone please advise if and how pictures (such as jpg format) can be rotated in excel using VBA after they have been inserted into a workbook.

MAny thanks in advance

iken
 
Replies continue below

Recommended for you

Try this:

Sub Macro1()
ActiveSheet.Shapes("Picture").Rotation = 33#
End Sub

"Picture" is the name of your picture
33# means 33 degrees
as an example

Hope this helps

Mogens

 
Thanks
mgp,

however the sub you typed only applies to drawings drawn in excel (using drawing utilities.

It does not work for either jpg or bitmap images that have been imported into a worksheet.

I am unsure if what I am requiring is possible or not, but any further assistance would be greatly appreciated.

iken
 
You can't.

You need to rotate before insertion

TTFN
 
It works on my machine.

All I did was to record the macro while rotating the picture and then clean up the code. I tried to import a new picture and rotate this with the same code, this also worked.

I'll send you the spreadsheet if you mail me at mgp@mxl.dk

I know that some objects cannot be rotated (e.g. a text box) and I have also wondered sometimes objects are no longer rotatable even though I recalled they used to be. Never found out why though.

Could it be the properties of the picture that causes the rotation angle to freeze/lock?


regards
Mogens
 
I've tried your code on various imported objects and get a permission error (runtime error 70) .

The code seems to work only on autoshapes created in Excel.

My email is arbiter007@hotmail.com

TTFN
 
The new code does exactly the same, must be something unique to Excel2002.

Thanks for the email..

TTFN
 
Bad luck then

So the answer to iken is that it works in Excel 2002 but apparently not in previous versions.

Regards
Mogens
 
Many thanks mgp & IRstuff, looks like it may be time to upgrade my Excel.

iken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor