Resize imported pictures

  • Thread starter Sören_Marodören
  • Start date
S

Sören_Marodören

Hi,

I have a macro that goes through all imported pictures and change the size
on them to the same value. The new size is taken from my PicResize user form.

Sub Resize ()
Dim oInl As InlineShape
Size = PicResize.TextBox1.Value
For Each oInl In ActiveDocument.InlineShapes
oInl.ScaleWidth = Size
oInl.ScaleHeight = Size
Next
End Sub

Now I want to modify the code so that it only take the selected pictures.
How shall I do that?

What happens if nothing is selected?
What happens if other items like text or tables are selected?

Best regards,
Sören
 
H

Helmut Weber

Hi Sören,
Now I want to modify the code so that it only take the selected pictures.
How shall I do that?

like that:

For Each oInl In Selection.InlineShapes
oInl.ScaleWidth = size
oInl.ScaleHeight = size
Next
What happens if nothing is selected? Nothing
What happens if other items like text or tables are selected?
Nothing
--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
S

Sören_Marodören

Thank you Helmut,

You helped me with the fist code. And now with this modification.
You are my hero for the day.

Best regards,
/Sören
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top