rotate picture VBA

zgivod

New Member
Joined
Dec 6, 2018
Messages
17
am trying to upload a picture and then rotate it and move it to specific location but i cant seem to get it to rotate. i have this code bec. i want to save with document the picture


<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub tyh()

ActiveSheet
.Shapes.AddPicture _
Filename
:="C:\Users\dovi.dovi-PC\Desktop\ads bh\IMG-7042.jpg", _
linktofile
:=msoFalse, savewithdocument:=msoCTrue, _
Left
:=1200, Top:=0, Width:=350, Height:=604
EndSub</code>
 
Alternately, as the rotation will affect the placement for a non-square picture, you can omit the placement part of your original code, rotate the placed picture, then set the top and left properties after the rotation.

@Rick Rothstein
again in such a case i keep getting errors, i know im doing something wrong......

Code:
Sub tyh()


ActiveSheet.Shapes.AddPicture _
Filename:="C:\Users\dovi.dovi-PC\Desktop\ads bh\IMG-7042.jpg", _
LinkToFile:=msoFalse, savewithdocument:=msoCTrue,
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Rotation = 90
Left:=1200, Top:=604, Width:=350, Height:=604
End Sub
SYNTAX ERROR
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Code:
Sub tyh()

ActiveSheet.Shapes.AddPicture( _
Filename:="C:\Users\dovi.dovi-PC\Desktop\ads bh\IMG-7042.jpg", _
LinkToFile:=msoFalse, savewithdocument:=msoCTrue) = _
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Rotation = 90
End Sub
ERROR WRONG NUMBER OF ARGUMENTS OR INVALID PROPERTY ASSIGNMENT
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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