aehan was telling us:
aehan nous racontait que :
> Does anyone know how to program Word to scale graphics automatically,
> eg 50%, 25% and so on. I tried recording it but it didn't work, it
[quoted text clipped - 3 lines]
> searched through help sites and can't find anything on my own, but I
> have limited knowledge of where to find answers.
What do you mean by Automatically?
How can the logo be rescaled to either 25% or 50% automatically?
Do you mean that after the logo has been inserted, the user will select it,
and then click on the appropriate % button to rescale it?
What Word version?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
aehan - 01 Sep 2005 15:16 GMT
What I would like to do is to allow a user to select a graphic such as a
logo, click on a toolbar button which is based on a macro and choose a
re-scaling option, eg 50%, 25% and so on. I've worked around it a bit by
using code that allows the user to rescale a named picture, however each time
a picture (logo) is inserted, Word gives it a new name, so that one isn't as
good as I had thought. The code I am using is:
Sub ScaleDown_BlackOnWhite()
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
If s.Name = "BlackOnWhite" Then
Select Case s.Type
Case msoEmbeddedOLEObject, msoLinkedOLEObject, _
msoOLEControlObject, msoLinkedPicture, msoPicture
s.ScaleHeight 0.5, True
s.ScaleWidth 0.5, True
Case Else
s.ScaleHeight 0.5, False
s.ScaleWidth 0.5, False
End Select
End If
Next
End Sub
What I'd like it to do is rescale the selected object. Any ideas?
Many thanks
Aehan
> aehan was telling us:
> aehan nous racontait que :
[quoted text clipped - 13 lines]
> and then click on the appropriate % button to rescale it?
> What Word version?
Jean-Guy Marcil - 01 Sep 2005 15:40 GMT
aehan was telling us:
aehan nous racontait que :
> What I would like to do is to allow a user to select a graphic such
> as a logo, click on a toolbar button which is based on a macro and
[quoted text clipped - 3 lines]
> it a new name, so that one isn't as good as I had thought. The code
> I am using is:
You have to check whether the selection contains a picture, and if it does,
you have to check if it is inline or floating because the inline pictures
will need the scale properties, whereas the floating ones will need the
scale methods. Try this code:
With Selection
Select Case .Type
Case 7 'Inline shape
.InlineShapes(1).ScaleHeight = 50
.InlineShapes(1).ScaleWidth = 50
Case 8 'Floating picture
.ShapeRange(1).ScaleHeight 0.5, True
.ShapeRange(1).ScaleWidth 0.5, True
Case Else
MsgBox "The current selection is not a picture." _
& vbCrLf & "Make sure you select only the picture itself.",
_
vbExclamation, "Error"
End Select
End With

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
aehan - 01 Sep 2005 15:59 GMT
Thank you very much, the code is exactly what I want, you are the biz!!
Cheers!!
> aehan was telling us:
> aehan nous racontait que :
[quoted text clipped - 29 lines]
> End Select
> End With
aehan - 01 Sep 2005 15:21 GMT
Sorry, forgot to say Word 2002.
> aehan was telling us:
> aehan nous racontait que :
[quoted text clipped - 13 lines]
> and then click on the appropriate % button to rescale it?
> What Word version?