Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Get paragraphs from MS word in VBA
Name: Noob22 Date: July 27, 2005 at 13:43:57 Pacific OS: xp pro CPU/Ram: pentium 4/ 512
Comment:
Hey guys Im creating a macro that takes a specific paragraph from a word file and then dumps it into Excel. I have some code but it doesn't work:
Private Sub ImportCommandButton_Click() Dim FilePath As String Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim para As Paragraph FilePath = Application.GetOpenFilename("Microsoft Word Document (*.doc), *.doc") Set wrdApp = CreateObject("Word.Application") wrdApp.Visible = False Set wrdDoc = wrdApp.Documents.Add ' create a new document Set wrdDoc = wrdApp.Documents.Open(FilePath) wrdDoc.Select para = wrdDoc.para(1) Worksheets("sheet1").Range("A1").Value = para wrdDoc.Close End Sub
The error is Invalid use of property where it says "para = wrdDoc.para(1)
Any help is appreciated!!
If a person is perseverant, although he/she is hard of understanding, will become intelligent; and although he/she is weak will be transformed into strong
Name: rhawk7938 Date: July 28, 2005 at 11:43:11 Pacific
Reply:
Just a thought. Is "para" a valid variable name?
0
Response Number 2
Name: Noob22 Date: July 28, 2005 at 12:33:38 Pacific
Reply:
I don't see why not!!
If a person is perseverant, although he/she is hard of understanding, will become intelligent; and although he/she is weak will be transformed into strong
0
Response Number 3
Name: Grok Lobster Date: July 28, 2005 at 15:02:46 Pacific
Reply:
Try using para = wrdDoc.paragraphs(1) and then learn to use the Help features.
Summary: Hi Mike . Thank you for your email. What I want is REMOVE spanish from MS-Words Spell Checker . In Tools / Language / Set Language, I get the Windows with English, French & Spanish ticked. How do I re...
Summary: Trying to copy MS Word Text, including footer text, and paste into Notepad, but it doesn't paste the footer text. Want to be able to some how distinguish where page breaks occur from MS Word, when pas...
Summary: I'm trying to produce a summary of the words in a specific document, with a list of each word and how often they appear. Is there such a function or add-on for Microsoft Word? Or perhaps another text ...