Consulting

Results 1 to 2 of 2

Thread: Updating ActiveX Image Control when opening document

  1. #1
    VBAX Regular
    Joined
    Feb 2015
    Posts
    76
    Location

    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.

    Chunk

  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
            oStory.Fields.Update
            If oStory.StoryType <> wdMainTextStory Then
                While Not (oStory.NextStoryRange Is Nothing)
                    Set oStory = oStory.NextStoryRange
                    oStory.Fields.Update
                Wend
            End If
        Next oStory
    lbl_Exit:
        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
    http://www.gmayor.com

Posting Permissions

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