Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

Graphics

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aehan - 31 Aug 2005 13:18 GMT
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 only recorded the
position of the graphic on the page rather than rescaling it.  I need to have
a variety of rescaling options for a logo.  Any help would be gratefully
received and appreciated.  I've searched through help sites and can't find
anything on my own, but I have limited knowledge of where to find answers.

Many thanks
Aehan
Jean-Guy Marcil - 01 Sep 2005 14:47 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.