Copying pictures from Excel to Word

T

TT

Hi,

I'm trying to copy ranges of cells in Excel (on separate sheets) to Word as
picture. The pictures should appear on different pages, that is on page 1, 2
etc. Now they appear all on page 1 on top of each other. I can't figure out
what's the problem. I'll attach the code here, I'd be grateful if someone
could help me out here.

TT

------------------------

Set appWD = CreateObject("Word.Application.11")
appWD.Visible = True
appWD.Documents.Add
appWD.Selection.InsertBreak
appWD.Selection.InsertBreak
Sheets("E1").Select
Range("A1:H53").Select
Selection.Copy
appWD.Selection.PasteSpecial DataType:=wdPasteMetafilePicture
Sheets("TV").Select
Range("A1:D41").Select
Selection.Copy
appWD.Selection.GoTo What:=wdGoToPage, which:=2
appWD.Selection.PasteSpecial DataType:=wdPasteMetafilePicture
 
J

Jean-Guy Marcil

TT was telling us:
TT nous racontait que :
Hi,

I'm trying to copy ranges of cells in Excel (on separate sheets) to
Word as picture. The pictures should appear on different pages, that
is on page 1, 2 etc. Now they appear all on page 1 on top of each
other. I can't figure out what's the problem. I'll attach the code
here, I'd be grateful if someone could help me out here.

TT

------------------------

Set appWD = CreateObject("Word.Application.11")
appWD.Visible = True
appWD.Documents.Add
appWD.Selection.InsertBreak
appWD.Selection.InsertBreak
Sheets("E1").Select
Range("A1:H53").Select
Selection.Copy
appWD.Selection.PasteSpecial DataType:=wdPasteMetafilePicture
Sheets("TV").Select
Range("A1:D41").Select
Selection.Copy
appWD.Selection.GoTo What:=wdGoToPage, which:=2
appWD.Selection.PasteSpecial DataType:=wdPasteMetafilePicture

Try this instead:

Dim AppWD As Word.Application
Dim DocWD As Word.Document
Dim RangeWD As Word.Range

Set AppWD = CreateObject("Word.Application.11")
AppWD.Visible = True

Set DocWD = AppWD.Documents.Add
With DocWD
Set RangeWD = .Range
Sheets("E1").Select
Range("A1:H53").Select
Selection.Copy
With RangeWD
.PasteSpecial DataType:=wdPasteMetafilePicture
.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertBreak wdSectionBreakNextPage
End With
Sheets("TV").Select
Range("A1:D41").Select
Selection.Copy
With RangeWD
.PasteSpecial DataType:=wdPasteMetafilePicture
.InsertParagraphAfter
End With
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
T

TT

Thanks! Seems to work.

TT

Jean-Guy Marcil said:
TT was telling us:
TT nous racontait que :


Try this instead:

Dim AppWD As Word.Application
Dim DocWD As Word.Document
Dim RangeWD As Word.Range

Set AppWD = CreateObject("Word.Application.11")
AppWD.Visible = True

Set DocWD = AppWD.Documents.Add
With DocWD
Set RangeWD = .Range
Sheets("E1").Select
Range("A1:H53").Select
Selection.Copy
With RangeWD
.PasteSpecial DataType:=wdPasteMetafilePicture
.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertBreak wdSectionBreakNextPage
End With
Sheets("TV").Select
Range("A1:D41").Select
Selection.Copy
With RangeWD
.PasteSpecial DataType:=wdPasteMetafilePicture
.InsertParagraphAfter
End With
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top