Rotate Image within ShowPic Function

vandango05

Board Regular
Joined
Oct 6, 2008
Messages
110
Hi all. I've been using and adjusting an original function that came from this forum and have searched if someone has had this requirement before but coming up blank.

I'm looking to add a rotation to the displayed images and wonder if someone can help with the code?

Here is what i have.

Code:
Function ShowPicR(PicFile As String) As Boolean

Dim AC As Range
Static P As Shape
On Error GoTo done
Set AC = Application.Caller
If PicExists(P) Then
P.Delete
Else
'look for a picture already over cell
'For Each P In ActiveSheet.Shapes
For Each P In ActiveSheet.Shapes
If P.Type = msoLinkedPicture Then
If P.Left >= AC.Left And P.Left < AC.Left + AC.Width Then
If P.Top >= AC.Top And P.Top < AC.Top + AC.height Then
P.Delete
Exit For
End If
End If
End If
Next P
End If


Set P = ActiveSheet.Shapes.AddPicture(PicFile, True, True, AC.Left - Range("dn55"), AC.Top - Range("do55"), Range("DN63"), Range("DO63"))
ShowPicR = True
Exit Function
done:
ShowPicR = False
End Function

I'd like the amount of rotation to be determined by a value in cell A1 for example.

Hope someone has the know-how and can help!

Thank you.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You can use the Rotation property of the Shape object...

Code:
P.Rotation = Range("A1").Value

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,464
Members
449,163
Latest member
kshealy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top