View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier[_7_] Jon Peltier[_7_] is offline
external usenet poster
 
Posts: 115
Default Excel VBA - Easy way to paste chart to word document ?

If you paste the chart at a bookmark in Word, you can go back to the
bookmark, and delete the chart:

Paste at the bookmark:

' Go to bookmark "chart1"
WDApp.Selection.GoTo What:=wdGoToBookmark, Name:="chart1"

' Paste chart at cursor position
WDApp.Selection.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False

Delete the chart at the bookmark:

' Go to bookmark "chart1"
WDApp.Selection.GoTo What:=wdGoToBookmark, Name:="chart1"

' Extend selection one character right to select the shape
WDApp.Selection.MoveRight Unit:=wdCharacter, Count:=1, _
Extend:=wdExtend
WDApp.Selection.Delete

I wish I understood better how it worked, but Word's object model always
gives me a headache.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

JtR < wrote:

Thanks again for information

I have working macro now what pastes chart's to document.

But that document has multiple editors (users, macros), so i cant do
allways new document cos there is text what change by users. Any idea
to work with this ?


Example what type document i have:

text (users update text)

chartpicture (my macro puts this)
text (users update text)