
- #How to copy a graph from excel to word on a mac code#
- #How to copy a graph from excel to word on a mac Pc#
- #How to copy a graph from excel to word on a mac mac#
MsgBox "Other versions would require add'l logic.
#How to copy a graph from excel to word on a mac code#
"PasteAsPicture"Īnd some other code works in 2016+ (this is not real code, but bear with me). ExecuteĪnd this block of code works in 20. Typically this technique is used to accommodate changes in the object model which would raise a compile error.įor example, let's say this block of code works in 2003. Yes, and this would require identifying what works in each version, and using a technique called Conditional Compilation. Is it possible to write the code in a way that forces it to work in all versions of Office? The quest for version-independent (and OS-independent code)

You may have better luck with that method. I observe the same in Excel 2013, which is the latest version documented on MSDN and presumably same object model as 2016. However, both paste (whether PasteAndFormat or ExecuteMso were successfully replacing the new "selection". IOW, it doesn't default to replace, it just finds and selects. Execute was changing the selection - essentially the. Execute was not actually replacing the text. In 2010 Excel, I was able to see some similar issues, the.
#How to copy a graph from excel to word on a mac mac#
I don't have 2016 Excel, nor Mac OS, so I may not be able to answer #1, but I will share some of my findings in Excel 20 in case that may help you find the solution in 2016. How can I make this code version-independent and OS-independent?.Any thoughts would be greatly appreciated because this is quite an issue for me. If it is not possible to figure out why it doesn't work, is it possible to write the code in a way that forces it to work in all versions of Office? I tried to make sure all preferences are the same but could I have missed some preference that could be causing the problem. In the newer versions the token remains at the bottom of the chart and the chart is not resized. The token is replaced by the chart and the chart is resized. In the earlier versions of Office this script takes the active chart copies it and pastes it into Word by looking for the token and pasting it. You can either open your document from within Excel by going to File > Open or you can right-click on the file, select Open With, and then Excel. Text = "insert" & ChartName 'This is the token it is looking for in the Word document and is where the chart should be inserted. This method will walk you through the steps of copying and pasting from Excel into Word using a Windows or Mac desktop application. Set wrd = CreateObject("Word.Application") Here is the script that works but not on later versions of Office. And it doesn’t take a rocket scientist to add one to a Microsoft Word document. In a later version of Office (2016) the chart does not resize when pasted and the token it searches for does not get replaced with the chart as it does in the earlier versions. Visual data graphics are a great way to get your message across without words.
#How to copy a graph from excel to word on a mac Pc#
I have the following script in Excel and it works with Office 2003 for PC and Office Mac 2011.

I am trying to copy an Excel Chart to Word.
