Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy Chart from Excel to Word using VBA

Using VBA, how do I copy an chart from Excel to a Word document using VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Copy Chart from Excel to Word using VBA

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in message
...
Using VBA, how do I copy an chart from Excel to a Word document using VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy Chart from Excel to Word using VBA

Thanks, that looks like what I need.

--
Jonathan Allen


"Jon Peltier" wrote:

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in message
...
Using VBA, how do I copy an chart from Excel to a Word document using VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen




  #4   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Copy Chart from Excel to Word using VBA

When I try the code to Paste the Active Excel Chart at the Cursor in the
Active Word Document I get an error message that indicates that the command
is not available because the document is not open. However I do have a Word
Document open


Jon Peltier" wrote:

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in message
...
Using VBA, how do I copy an chart from Excel to a Word document using VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Copy Chart from Excel to Word using VBA

"The" document is not open, or "a" document is not open. The code should be
looking for any document.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Tom" wrote in message
...
When I try the code to Paste the Active Excel Chart at the Cursor in the
Active Word Document I get an error message that indicates that the
command
is not available because the document is not open. However I do have a
Word
Document open


Jon Peltier" wrote:

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in
message
...
Using VBA, how do I copy an chart from Excel to a Word document using
VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen








  #6   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Copy Chart from Excel to Word using VBA

Jon,

Here is my code. I have one routine to create the word document and another
to reference the active word doc and copy the charts into it:

Sub CopyCharts()

Dim WDApp As Word.Application
Dim WDDoc As Word.Document

Call CreateWordDocumentFromExcel

Dim i As Integer

' Reference existing instance of Word
Set WDApp = GetObject(, "Word.Application")

' Reference active document
Set WDDoc = WDApp.ActiveDocument (I get the error at this line)

For iCht = 1 To ActiveSheet.ChartObjects.count

With ActiveSheet.ChartObjects(iCht).Chart
' copy chart as a picture
.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
' Paste chart at cursor position
WDApp.Selection.PasteSpecial Link:=False,
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False

End With

Next

' Clean up
Set WDDoc = Nothing
Set WDApp = Nothing

End sub

Sub CreateWordDocumentFromExcel()

Dim oWord As Object
Set oWord = CreateObject("Word.application")
oWord.Visible = True
AppActivate oWord
With oWord.Documents
..Add
End With


'Set oWord = Nothing
End Sub


"Jon Peltier" wrote:

"The" document is not open, or "a" document is not open. The code should be
looking for any document.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Tom" wrote in message
...
When I try the code to Paste the Active Excel Chart at the Cursor in the
Active Word Document I get an error message that indicates that the
command
is not available because the document is not open. However I do have a
Word
Document open


Jon Peltier" wrote:

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in
message
...
Using VBA, how do I copy an chart from Excel to a Word document using
VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Copy Chart from Excel to Word using VBA

Is there only one running instance of Word? No hidden orphan instances that
are visible in the Task Manager?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Tom" wrote in message
...
Jon,

Here is my code. I have one routine to create the word document and
another
to reference the active word doc and copy the charts into it:

Sub CopyCharts()

Dim WDApp As Word.Application
Dim WDDoc As Word.Document

Call CreateWordDocumentFromExcel

Dim i As Integer

' Reference existing instance of Word
Set WDApp = GetObject(, "Word.Application")

' Reference active document
Set WDDoc = WDApp.ActiveDocument (I get the error at this line)

For iCht = 1 To ActiveSheet.ChartObjects.count

With ActiveSheet.ChartObjects(iCht).Chart
' copy chart as a picture
.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
' Paste chart at cursor position
WDApp.Selection.PasteSpecial Link:=False,
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False

End With

Next

' Clean up
Set WDDoc = Nothing
Set WDApp = Nothing

End sub

Sub CreateWordDocumentFromExcel()

Dim oWord As Object
Set oWord = CreateObject("Word.application")
oWord.Visible = True
AppActivate oWord
With oWord.Documents
.Add
End With


'Set oWord = Nothing
End Sub


"Jon Peltier" wrote:

"The" document is not open, or "a" document is not open. The code should
be
looking for any document.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Tom" wrote in message
...
When I try the code to Paste the Active Excel Chart at the Cursor in
the
Active Word Document I get an error message that indicates that the
command
is not available because the document is not open. However I do have a
Word
Document open


Jon Peltier" wrote:

http://peltiertech.com/Excel/XL_PPT.html

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


"Jonathan Allen" wrote in
message
...
Using VBA, how do I copy an chart from Excel to a Word document
using
VBA?
I can already copy cells and place them at Word bookmarks.


--
Jonathan Allen









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy an Excel chart into Word does not look the same MAB Excel Worksheet Functions 2 December 11th 07 07:45 AM
Copy chart from Excel to Word Medea Charts and Charting in Excel 4 November 28th 07 03:23 AM
copy an excel chart to word OyVey-CoCo Charts and Charting in Excel 1 July 26th 07 03:47 PM
Copy Chart from Excel to Word Jonathan Allen Excel Programming 1 July 27th 06 02:55 PM
How do I copy a table from Excel to Word or a chart to Ppt in a ma Linda Vincent Excel Programming 0 November 30th 05 06:00 PM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"