Results 1 to 5 of 5
  1. #1
    georgette
    Guest

    need a macro....

    I am working on large report at work involving cutting and pasting many Excel charts into Word documents. I am in Office 2000.

    In Excel, I have located all of the charts on separate worksheets and adjusted the font size to Arial 14pt. so that the fonts remain consistent when pasted into Word.

    Problem: When I just "paste" the chart into Word, the font size in Excel changes. (Does anyone know why?)

    Partial solution: When I "paste special", picture into Word, the font size remains Arial 14pt. in Excel, but the picture floats.

    MACRO NEEDED: I need a macro which, when the picture is selected in Word, will change the picture to "In line with text" (Format picture|Layout tab|In line with text) and change the size to 5.5" (Format|Size|Width) while locking the aspect ratio so the chart does not distort. My macro ability is limited to letting the system record my keystrokes in order to create the macro; this is not an option as the "In line with text" is grayed out.... :>(

    TIA,
    Georgette

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: need a macro....

    Georgette,

    Not sure why the font size changes, but in any case here is a macro that will cycle through every floating picture (Shape) in a document, lock the aspect ratio, change the width to 5.5 inches, and change it to in line with text (Inline Shape).

    <pre>Public Sub ConvertShapesToInlineShapes()
    Dim aShape As Shape
    For Each aShape In ActiveDocument.Shapes
    aShape.LockAspectRatio = msoTrue
    aShape.Width = InchesToPoints(5.5)
    aShape.ConvertToInlineShape
    Next aShape
    End Sub
    </pre>

    Gary

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Virginia, USA, Virginia, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: need a macro....

    Gary,
    Many thanks... however, I want to run this after I place EACH graphic, not all at once. Will your macro work this way, or can it only be run after ALL the pictures are pasted into the document?

    TIA,
    Georgette

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: need a macro....

    Georgette,

    I was afraid you were going to ask that! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Seriously, it's just a little easier to do them all at once, because you can access the Shapes collection via the Document object.

    Neither Selection nor Range give access to the Shapes collection, but it turns out you can get to the Shapes within a given Selection or Range by using ShapeRange.

    So here's a revised version which should allow you to run this on each graphic individually.

    <pre>Public Sub ConvertSelectedShapeToInlineShape()
    With Selection.ShapeRange
    If .Count = 1 Then
    .LockAspectRatio = msoTrue
    .Width = InchesToPoints(5.5)
    .ConvertToInlineShape
    End If
    End With
    End Sub
    </pre>

    Gary

  5. #5
    georgette
    Guest

    Re: need a macro....

    Thanks you so much. I will get someone at work to help me "get it into Word" so that I can try it!

    Thank you for your your HELP!!!

    Georgette

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •