|
-
Jul 5th, 2005, 03:52 AM
#1
Thread Starter
New Member
How to rotate an image in Excel using VBA
Hi all,
I'd like to know how to rotate a image (jpg) I inserted in my excel sheet. I have tried activesheet.shaperange.rotation, but I get an error (cannot edit the value). I hope you can help me out here.
Yours truly,
Berend Botje
-
Jul 5th, 2005, 04:05 AM
#2
Thread Starter
New Member
Re: How to rotate an image in Excel using VBA
For those of you interested in the code I use:
Sub InsertJPG
ActiveSheet.Pictures.Insert("C:\PicturesToInsert\Picture1.jpg").Select
Call GetAngle
Call DoRotation
End sub
Sub GetAngle
ChooseAgain:
Angle = InputBox("Select Rotation. (1-4)", "Angle", "1", 400)
If Angle = "" Then
MsgBox "Choose one please.", vbOKOnly, "Error"
GoTo ChooseAgain
End If
If IsNumeric(Angle) = True Then
Angle = CInt(Angle)
Else: MsgBox "Only 1-4 please. No text.", vbOKOnly, "Error"
GoTo ChooseAgain
End If
If Again < 1 Or Again > 4 Then GoTo ChooseAgain
End Sub
Sub DoRotation()
Dim ANG As Integer
If Angle = 1 Then
ANG = 0
ElseIf Angle = 2 Then
ANG = 90
ElseIf Angle = 3 Then
ANG = 180
ElseIf Angle = 4 Then
ANG = 270
End If
Selection.ShapeRange.Rotation = ANG
End Sub
The subs are all in different modules and Angle is defined as Public.
-
Jul 6th, 2005, 07:30 AM
#3
Thread Starter
New Member
Re: How to rotate an image in Excel using VBA
Low response rate on this forum... Is there any other forum where I can leave this question?
Last edited by brad jones; Jul 7th, 2005 at 01:43 PM.
Reason: Advertising link removed by admin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|