Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
I need to open a word doc and insert cell values at the end of certain lines
from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
You'll have to set a library reference to the Word object library. Then,
when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
you wouldn't happen to have an explanple would you?
"Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
Shawn:
This code sets an object to the Word application, and then sets and object to a single document. The object "WordDoc" is your Word document, which can be manipulated using the Word object model. If you've set the library reference to Word, then the Word objects, properties, and methods are available in the VBA Editor (such as my "Dim rng As Word.Range". Also note the ending code. Ed Dim Word As New Word.Application Dim WordDoc As New Word.document Dim rng As Word.Range ''' "doc" in the following line is a string variable ''' previously Dim'd and set to the desired ''' document's complete file path and name Set WordDoc = Word.Documents.Open(doc) Word.Visible = True Set rng = WordDoc.Paragraphs.Last.Range WordDoc.Close Word.Quit Set WordDoc = Nothing Set Word = Nothing "Shawn G." wrote in message ... you wouldn't happen to have an explanple would you? "Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
Dim Word As New Word.Application gives User-defined type not defined???
I am using Office 2003 if that means anything. "Ed" wrote: Shawn: This code sets an object to the Word application, and then sets and object to a single document. The object "WordDoc" is your Word document, which can be manipulated using the Word object model. If you've set the library reference to Word, then the Word objects, properties, and methods are available in the VBA Editor (such as my "Dim rng As Word.Range". Also note the ending code. Ed Dim Word As New Word.Application Dim WordDoc As New Word.document Dim rng As Word.Range ''' "doc" in the following line is a string variable ''' previously Dim'd and set to the desired ''' document's complete file path and name Set WordDoc = Word.Documents.Open(doc) Word.Visible = True Set rng = WordDoc.Paragraphs.Last.Range WordDoc.Close Word.Quit Set WordDoc = Nothing Set Word = Nothing "Shawn G." wrote in message ... you wouldn't happen to have an explanple would you? "Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
You need to have the MS Word application installed to use the MS Word
functions. Assuming you're using Visual Basic 6.0, Select Project / References ... and click the box labeled "Microsoft Word 9.0 Object Library", and then click the "OK" button. After this, the calls to Work programming classes should work. -- In theory, there is no difference between theory and practice; in practice, there is. "Shawn G." wrote: Dim Word As New Word.Application gives User-defined type not defined??? I am using Office 2003 if that means anything. "Ed" wrote: Shawn: This code sets an object to the Word application, and then sets and object to a single document. The object "WordDoc" is your Word document, which can be manipulated using the Word object model. If you've set the library reference to Word, then the Word objects, properties, and methods are available in the VBA Editor (such as my "Dim rng As Word.Range". Also note the ending code. Ed Dim Word As New Word.Application Dim WordDoc As New Word.document Dim rng As Word.Range ''' "doc" in the following line is a string variable ''' previously Dim'd and set to the desired ''' document's complete file path and name Set WordDoc = Word.Documents.Open(doc) Word.Visible = True Set rng = WordDoc.Paragraphs.Last.Range WordDoc.Close Word.Quit Set WordDoc = Nothing Set Word = Nothing "Shawn G." wrote in message ... you wouldn't happen to have an explanple would you? "Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
In the VBA Editor, go to ToolsReferences, and select your Microsoft Word
type library. "Shawn G." wrote in message ... Dim Word As New Word.Application gives User-defined type not defined??? I am using Office 2003 if that means anything. "Ed" wrote: Shawn: This code sets an object to the Word application, and then sets and object to a single document. The object "WordDoc" is your Word document, which can be manipulated using the Word object model. If you've set the library reference to Word, then the Word objects, properties, and methods are available in the VBA Editor (such as my "Dim rng As Word.Range". Also note the ending code. Ed Dim Word As New Word.Application Dim WordDoc As New Word.document Dim rng As Word.Range ''' "doc" in the following line is a string variable ''' previously Dim'd and set to the desired ''' document's complete file path and name Set WordDoc = Word.Documents.Open(doc) Word.Visible = True Set rng = WordDoc.Paragraphs.Last.Range WordDoc.Close Word.Quit Set WordDoc = Nothing Set Word = Nothing "Shawn G." wrote in message ... you wouldn't happen to have an explanple would you? "Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
edit word doc
Thanks!!!!!!
"Ed" wrote: In the VBA Editor, go to ToolsReferences, and select your Microsoft Word type library. "Shawn G." wrote in message ... Dim Word As New Word.Application gives User-defined type not defined??? I am using Office 2003 if that means anything. "Ed" wrote: Shawn: This code sets an object to the Word application, and then sets and object to a single document. The object "WordDoc" is your Word document, which can be manipulated using the Word object model. If you've set the library reference to Word, then the Word objects, properties, and methods are available in the VBA Editor (such as my "Dim rng As Word.Range". Also note the ending code. Ed Dim Word As New Word.Application Dim WordDoc As New Word.document Dim rng As Word.Range ''' "doc" in the following line is a string variable ''' previously Dim'd and set to the desired ''' document's complete file path and name Set WordDoc = Word.Documents.Open(doc) Word.Visible = True Set rng = WordDoc.Paragraphs.Last.Range WordDoc.Close Word.Quit Set WordDoc = Nothing Set Word = Nothing "Shawn G." wrote in message ... you wouldn't happen to have an explanple would you? "Ed" wrote: You'll have to set a library reference to the Word object library. Then, when you set an object to your document, you can use the Word object model references (line, paragraph, story, and so on) to manipulate the ranges and text of a Word document from within Excel VBA. Ed "Shawn G." wrote in message ... I need to open a word doc and insert cell values at the end of certain lines from within excel. I can get the file open but how do I control where the text goes in the word application? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Excel count of 1 word if found in multi-word cells of column | Excel Worksheet Functions | |||
Can I paste an EXCEL chart from a word doc into EXCEL and edit it | Excel Discussion (Misc queries) | |||
Can't edit Excel or Word documents | Excel Discussion (Misc queries) | |||
how to protect a word art in excel from edit | Excel Worksheet Functions | |||
Why can't I edit my excel document? Edit buttons shaded. | New Users to Excel |