Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-11-2025, 07:40 AM
Italophile Italophile is offline Updating tables in Word Windows 11 Updating tables in Word Office 2021
Expert
 
Join Date: Mar 2022
Posts: 563
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

The first mistake you have made is using Late Binding.
There is no value to using late binding in this instance. The only advantage to late binding is version independence, i.e. you can write code in a newer version and it will theoretically work in an older one. But that advantage is lost unless you also use late binding for the host application code as Office is usually installed as a package. It is better to use early binding when working with other Office applications and reserve late binding for other commonly used libraries, e.g. ADO or XML.

By adding a reference to the Excel library (Tools | References) and declaring the object variables with their correct types (eg. Dim chartObj As xl.Chart) you get the benefit of IntelliSense.

Instead of
Code:
chartObj.Copy
What you need is
Code:
chartObj.ChartArea.Copy
When pasted this will give you a linked chart but the link can be broken by adding something like
Code:
bmRange.InlineShapes(1).Chart.ChartData.Activate
bmRange.InlineShapes(1).Chart.ChartData.BreakLink
Reply With Quote
 

Tags
charts, copy, update



Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating tables in Word Is there a way to stop macro modifications from undoing when Updating Word Linked Tables? soroush.kalantari Word VBA 3 06-27-2021 06:15 PM
Problem With Updating Linked Excel Tables in Word 2013 maverick1714 Word 6 09-30-2014 12:30 AM
Updating tables in Word Word 2013 Fields not updating awaywithpixie Word 1 09-10-2013 10:35 AM
Updating lists of figures/Tables in a protected document IHARKIS Word 0 03-02-2011 04:39 AM
Auto-updating basic math functions & cross-referencing tables FranklinBluth Word Tables 13 11-19-2009 10:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft