Community discussion forum

read the word document line by line thru visual basic 6.0

Tags: India
  • 7 months ago

    hi friends,

              i want to read the word document line by line thru visual basic 6.0. i  can able 2 read the data  line by line in text file .but i cant able 2 read it in word document. can anyone help me regarding this

     

    regards

    vivek

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 7 months ago

    Hi,

    Try

    'Create the Word Object
    Dim objWord As Word.Application
    Dim objDocContent As Word.Range
    Dim sFileName as String

    sFileName = App.Path & "\" & "Test.doc"

    Set objWord = New Word.Application

    'Use to show or hide Word from the users view
    objWord.Visible = True

    'Open the Document
    objWord.Documents.Open sFileName

    'Get the contents
    Set objDocContent = objWord.ActiveDocument.Content

    'Put the contents into a textbox
    Text1.text = objDocContent

    'Quit Word
    objWord.Quit

    'Destroy the object
    Set objWord = Nothing

Post a reply

Enter your message below

Sign in or Join us (it's free).