Results 1 to 2 of 2

Thread: Updating ActiveX Image Control when opening document

  1. #1
    VBAX Regular
    Feb 2015

    Updating ActiveX Image Control when opening document

    I have a weekly report that I produce for 6 different projects. Each report contains 50 or so graphs.
    I am currently experimenting with a template that is using ActiveX Image Controls for each graph.

    I have converted the graphs to jpgs and linked the control to the image, and am wondering if there
    is a way to have the image control "refresh" the image when the document opens, or is there a way
    to have some vba code perform the work?

    Any help or direction is greatly appreciated.

    Thanks in advance for your time.


  2. #2
    Why are you inserting activex controls? Surely simply inserting the images in-line as links would suffice? If you wish to constrain the sizes, put them in table cells of fixed width or frames.

    If you are creating the charts in Excel, you could simply link to the charts themselves.

    You can update the links with the following macro

    Sub UpdateAllFields()
    Dim oStory As Range
        For Each oStory In ActiveDocument.StoryRanges
            If oStory.StoryType <> wdMainTextStory Then
                While Not (oStory.NextStoryRange Is Nothing)
                    Set oStory = oStory.NextStoryRange
            End If
        Next oStory
        Set oStory = Nothing
        Exit Sub
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes

Posting Permissions

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