Thread: [Solved] Updating/Format Objects
View Single Post
 
Old 01-22-2015, 12:54 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You should be able to do that e.g. by using a sub which you can call for each chart to set the relative size to what is required.

Code:
Sub Macro1()
ScaleLinkedChart "Chart 4", 75
End Sub

Sub ScaleLinkedChart(strChart As String, lng_Size As Long)
'strChart is the chart name e.g. 'Chart 4'
'lng_size is the percentage of the original size e.g. 75 = 75%
Dim ofld As Field
Dim oShape As InlineShape
    For Each ofld In ActiveDocument.Fields
        If ofld.Type = wdFieldLink Then
            If InStr(1, ofld.Code, strChart) > 0 Then
                Set oShape = ofld.InlineShape
                oShape.ScaleHeight = lng_Size
                oShape.ScaleWidth = lng_Size
                Exit For
            End If
        End If
    Next ofld
lbl_Exit:
    Set ofld = Nothing
    Set oShape = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote