Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default How to select the first 5 paragraphs in a Word Document from Excel

Hi

this seems to work

Sub testword()
Dim wdApp As Word.Application
Set wdApp = New Word.Application
argFullname = "C:\test.doc"
wdApp.documents.Open Filename:=argFullname, ReadOnly:=argReadOnly
wdApp.Selection.HomeKey Unit:=wdStory
wdApp.Selection.MoveDown Unit:=wdParagraph, Count:=5, Extend:=wdExtend
wdApp.Selection.Copy
wdApp.documents(argFullname).Close SaveChanges:=False
wdApp.Application.Quit
Set wdApp = Nothing

ThisWorkbook.Activate
Sheets("Sheet4").Activate
Range("A1").Select
ActiveSheet.Paste
Msgbox "Done"
End Sub


Hope this helps
Cheers
JulieD

"quartz" wrote in message
...
Does anyone know how to select the first 5 paragraphs in a Word document
from
Excel?

I can get a ref and open the document. Now I need to select the first 5
paragraphs and copy them to the clipboard. My code so far looks like this:

Dim wdApp As Word.Application
Set wdApp = New Word.Application
wdApp.Documents.Open Filename:=argFullName, ReadOnly:=argReadOnly
<<<code to select first 5 paragraphs needed here
<<<code to copy needed here
wdApp.Documents(FileName).Close SaveChanges:=False
wdApp.Application.Quit
Set wdApp = Nothing

Thanks in advance.



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
How Do I Replace Paragraphs With New Paragraphs In Excel? vselin1 Excel Discussion (Misc queries) 7 July 29th 09 04:21 PM
how to format large word paragraphs into an excel file dingbat Excel Worksheet Functions 1 June 16th 09 07:14 PM
Moving paragraphs from MS Word to Excel [email protected] Excel Discussion (Misc queries) 3 March 2nd 05 02:36 AM
Display Word Paragraphs in Excel??? quartz[_2_] Excel Programming 2 January 10th 05 07:39 PM
Find paragraphs in word and export to Excel Matt Shaw Excel Programming 1 July 19th 03 09:22 AM


All times are GMT +1. The time now is 04:11 AM.

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

About Us

"It's about Microsoft Excel"