+ Reply to Thread
Results 1 to 8 of 8

edit word doc

  1. #1
    Shawn G.
    Guest

    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. #2
    Ed
    Guest

    Re: 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." <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Shawn G.
    Guest

    Re: 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." <[email protected]> wrote in message
    > news:[email protected]...
    > > 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. #4
    Ed
    Guest

    Re: 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." <[email protected]> wrote in message
    news:[email protected]...
    > 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." <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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. #5
    Shawn G.
    Guest

    Re: 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." <[email protected]> wrote in message
    > news:[email protected]...
    > > 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." <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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. #6
    LabElf
    Guest

    Re: 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." <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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." <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > 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. #7
    Ed
    Guest

    Re: edit word doc

    In the VBA Editor, go to Tools>>References, and select your Microsoft Word
    type library.

    "Shawn G." <[email protected]> wrote in message
    news:[email protected]...
    > 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." <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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." <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > 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. #8
    Shawn G.
    Guest

    Re: edit word doc

    Thanks!!!!!!

    "Ed" wrote:

    > In the VBA Editor, go to Tools>>References, and select your Microsoft Word
    > type library.
    >
    > "Shawn G." <[email protected]> wrote in message
    > news:[email protected]...
    > > 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." <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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." <[email protected]> wrote in message
    > > > > > news:[email protected]...
    > > > > > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1