Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Pasting text from Excel to Word (macro)

I've asked before but nobody could then help me - maybe this time I get
lucky. :)

I'm trying to paste text from Excel to Word. I cannot get it to work
right - everything is pasted on line 1 in Word. The previously pasted text
gets replaces by the later pasted text. The later text should of course be
pasted on line 2 etc. Can anyone help me out here?

Here's the macro I've been trying to use:

Sub TW()

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("T").Select
Range("A15").Select
Selection.Copy
With RangeWD
..Font.Name = "Arial"
..PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
..InsertParagraphAfter
..Collapse wdCollapseEnd
..InsertParagraphAfter
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A17").Select
Selection.Copy
With RangeWD
..Font.Name = "Arial"
..PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
..InsertParagraphAfter
'.InsertParagraphAfter
..Collapse wdCollapseEnd
..InsertParagraphAfter
End With

End With

Sheets("S").Activate

End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Pasting text from Excel to Word (macro)

Maybe looking at how Debra Dalgleish advances to a new line in her code to paste
comments from excel to word would help:

http://www.contextures.com/xlcomments03.html#CopyToWord



TT wrote:

I've asked before but nobody could then help me - maybe this time I get
lucky. :)

I'm trying to paste text from Excel to Word. I cannot get it to work
right - everything is pasted on line 1 in Word. The previously pasted text
gets replaces by the later pasted text. The later text should of course be
pasted on line 2 etc. Can anyone help me out here?

Here's the macro I've been trying to use:

Sub TW()

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("T").Select
Range("A15").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A17").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
'.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With

End With

Sheets("S").Activate

End Sub


--

Dave Peterson
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 Word Text - strange results Alan Smith Excel Discussion (Misc queries) 0 November 25th 09 07:12 PM
Copying Color-Coded Text and Pasting it in that format to Word Hope 2002 Excel Discussion (Misc queries) 5 July 29th 08 10:48 AM
losing text from text box when pasting selection to word rallyworker Excel Discussion (Misc queries) 0 April 13th 07 08:44 AM
Macro to Extract Text From Word Table Into Excel? V. Hatherley Excel Discussion (Misc queries) 1 August 27th 06 04:12 PM
Macro-Text from word doc paste to excel empty row J Excel Programming 1 July 26th 03 04:22 AM


All times are GMT +1. The time now is 08:25 AM.

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"