Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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
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
Need Excel count of 1 word if found in multi-word cells of column Function_Challenged Excel Worksheet Functions 1 August 27th 09 12:08 AM
Can I paste an EXCEL chart from a word doc into EXCEL and edit it camper641 Excel Discussion (Misc queries) 1 November 18th 08 02:04 PM
Can't edit Excel or Word documents daxdarko Excel Discussion (Misc queries) 0 October 29th 08 05:50 PM
how to protect a word art in excel from edit sancbey Excel Worksheet Functions 0 September 30th 05 12:35 PM
Why can't I edit my excel document? Edit buttons shaded. Arl @ CBC New Users to Excel 3 September 7th 05 01:18 AM


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