Results 1 to 7 of 7

Thread: how to access comments from a word file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179

    how to access comments from a word file

    Hi

    how should i access the comments that are written at bottom of the word file and save it to a access database.
    can any one help me pls

  2. #2
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    VB Code:
    1. Dim appWord As New Word.Application
    2. Dim docWord As New Word.Document
    3.  
    4. appWord.Documents.Open "e:\benoni's documenten\new.doc"
    5. Set docWord = appWord.Documents(1)
    6.  
    7. MsgBox docWord.Comments(1).Range.Text
    8.  
    9. docWord.Close (0)
    10. appWord.Quit
    11. Set docWord = Nothing
    12. Set appWord = Nothing
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179
    hi

    it is not working
    when i give the file name for which i want to see the comments
    it is showing me an error as
    " invalid outside procedure "

  4. #4
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    try this:

    VB Code:
    1. Private Sub Form_Load()
    2. Dim appWord As New Word.Application
    3. Dim docWord As New Word.Document
    4.  
    5. appWord.Documents.Open "e:\benoni's documenten\new.doc"
    6. Set docWord = appWord.Documents(1)
    7.  
    8. MsgBox docWord.Comments(1).Range.Text
    9.  
    10. docWord.Close (0)
    11. appWord.Quit
    12. Set docWord = Nothing
    13. Set appWord = Nothing
    14. End Sub
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179
    Hi

    i it is working but i am not satisfied as yet
    what it d is it tracks for any first comment in the file and omits all the rest comments that are there in the file
    what i want is it should go to the last line of the page and see if there is any comment on the last line
    if there is then record the comment and save it to the database or else live it

  6. #6
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    replace this line:
    VB Code:
    1. MsgBox docWord.Comments(1).Range.Text

    by this line:

    VB Code:
    1. Dim i As Integer
    2. For i = 1 To docWord.Comments.Count
    3.     'write here your code to write the comments to the Database
    4.     MsgBox docWord.Comments(i).Range.Text
    5. Next i

    this shows you all the comments in a worddocument
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179
    Hi
    that was very much help full
    thanks
    but on the last line of the document if there are two comments one in between the line and one at the end of the line.
    And i just want to read the comment that is at the end of line of the documents last line
    is that possible help pls

Posting Permissions

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



Click Here to Expand Forum to Full Width