Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default pasting excel range into a Word doc

Hi
I have managed to write code to copy a specified range in a worksheet and
paste it into a Word doc.

I have used:
Dim wdApp As Word.Application
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
wdApp.Documents.Open "C:\Documents and Settings\tquser\My
Documents\docName.doc"
'copies data from Excel range
Worksheets("Data Sheet").Select
Range("A1:I18").Copy
'pastes data into specified Word doc
wdApp.Activate
wdApp.Selection.Paste
Application.CutCopyMode = False

However, it pastes it at the very top of the first page.
I would like to be able to specify a position on the page or, maybe on 3rd
or 4 the page if this is possible.
At the moment the 1st page has a Table which is used as a facesheet for a
fax document, so the range needs to be pasted below this Table.
I haven't a clue how to do it and I do hope someone can help.
Many thanks
Peter V


  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default pasting excel range into a Word doc

Peter:

If you can set a bookmark into your Word doc at the point you want to paste,
then you can use something like this:
Sub Foo_GetWordHere()

Dim wdApp As Word.Application
Dim wdDoc As Word.Document

Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open("C:\Documents and
Settings\username\Desktop\TestMe.doc")

wdDoc.Bookmarks("Here").Range.Paste

End Sub

Ed

"Peter V" wrote in message
...
Hi
I have managed to write code to copy a specified range in a worksheet and
paste it into a Word doc.

I have used:
Dim wdApp As Word.Application
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
wdApp.Documents.Open "C:\Documents and Settings\tquser\My
Documents\docName.doc"
'copies data from Excel range
Worksheets("Data Sheet").Select
Range("A1:I18").Copy
'pastes data into specified Word doc
wdApp.Activate
wdApp.Selection.Paste
Application.CutCopyMode = False

However, it pastes it at the very top of the first page.
I would like to be able to specify a position on the page or, maybe on 3rd
or 4 the page if this is possible.
At the moment the 1st page has a Table which is used as a facesheet for a
fax document, so the range needs to be pasted below this Table.
I haven't a clue how to do it and I do hope someone can help.
Many thanks
Peter V




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default pasting excel range into a Word doc

Thank you Ed.
UnfortuanatelyI am not familiar with Bookmarks, so any help with them or
alternative method would be appreciated.
Peter V
"Ed" wrote in message
...
Peter:

If you can set a bookmark into your Word doc at the point you want to

paste,
then you can use something like this:
Sub Foo_GetWordHere()

Dim wdApp As Word.Application
Dim wdDoc As Word.Document

Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open("C:\Documents and
Settings\username\Desktop\TestMe.doc")

wdDoc.Bookmarks("Here").Range.Paste

End Sub

Ed

"Peter V" wrote in message
...
Hi
I have managed to write code to copy a specified range in a worksheet

and
paste it into a Word doc.

I have used:
Dim wdApp As Word.Application
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
wdApp.Documents.Open "C:\Documents and Settings\tquser\My
Documents\docName.doc"
'copies data from Excel range
Worksheets("Data Sheet").Select
Range("A1:I18").Copy
'pastes data into specified Word doc
wdApp.Activate
wdApp.Selection.Paste
Application.CutCopyMode = False

However, it pastes it at the very top of the first page.
I would like to be able to specify a position on the page or, maybe on

3rd
or 4 the page if this is possible.
At the moment the 1st page has a Table which is used as a facesheet for

a
fax document, so the range needs to be pasted below this Table.
I haven't a clue how to do it and I do hope someone can help.
Many thanks
Peter V






  #4   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default pasting excel range into a Word doc

A Bookmark is a Word field that exists in a specific position in a Word
document. It can contain almost anything, and can also be used just as a
place marker when you GoTo that bookmark. Open Word, open Help (F1), and
look up "bookmark". You will soon know quite a bit about bookmarks! <g
They can be set, populated, found, and deleted in code also - open the Word
VBA window and use F1 there to get code help for bookmarks.

ED

"Peter V" wrote in message
...
Thank you Ed.
UnfortuanatelyI am not familiar with Bookmarks, so any help with them or
alternative method would be appreciated.
Peter V
"Ed" wrote in message
...
Peter:

If you can set a bookmark into your Word doc at the point you want to

paste,
then you can use something like this:
Sub Foo_GetWordHere()

Dim wdApp As Word.Application
Dim wdDoc As Word.Document

Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open("C:\Documents and
Settings\username\Desktop\TestMe.doc")

wdDoc.Bookmarks("Here").Range.Paste

End Sub

Ed

"Peter V" wrote in message
...
Hi
I have managed to write code to copy a specified range in a worksheet

and
paste it into a Word doc.

I have used:
Dim wdApp As Word.Application
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
wdApp.Documents.Open "C:\Documents and Settings\tquser\My
Documents\docName.doc"
'copies data from Excel range
Worksheets("Data Sheet").Select
Range("A1:I18").Copy
'pastes data into specified Word doc
wdApp.Activate
wdApp.Selection.Paste
Application.CutCopyMode = False

However, it pastes it at the very top of the first page.
I would like to be able to specify a position on the page or, maybe on

3rd
or 4 the page if this is possible.
At the moment the 1st page has a Table which is used as a facesheet for

a
fax document, so the range needs to be pasted below this Table.
I haven't a clue how to do it and I do hope someone can help.
Many thanks
Peter V








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
Pasting Excel ('07) Range with Chart in Word ('07) Blaknecr8 Charts and Charting in Excel 0 January 11th 08 08:20 PM
Pasting excel into word kmbenn0 Excel Discussion (Misc queries) 1 June 27th 07 09:50 PM
Pasting Between Excel and Word Alex Excel Programming 1 May 19th 06 09:24 PM
VB automated pasting of Excel range into Word document ardvk Excel Programming 3 January 8th 05 06:09 AM
Pasting a Range to Word Ian Mangelsdorf Excel Programming 0 January 22nd 04 12:34 AM


All times are GMT +1. The time now is 08:15 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"