Forum Discussion

sanjay0288's avatar
sanjay0288
Frequent Contributor
12 years ago

Help Needed in getting text from a notepad

Hi,

In one of the scenario i need to fect  particular text from notepad.The entire object is getting higlighted as edit control. Is there any method where I can fetch the text what I am looking for and store it in a variable.



Kindly help

5 Replies

  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi,

    Yes , there is method to fetch the text from the text control.

    Use the "Text" property of the control , it returns all the text contained within the control.



    I hope this has been of some help.
    • praneshm's avatar
      praneshm
      New Contributor

      Use the .TEXTCONTENT property to fetch the value of the Object, say a textbox or a label or any object of your interest(if applicable)

      • praneshm's avatar
        praneshm
        New Contributor

        Use the below code to read from the entire text file;

        Sub TextfileRead

         Dim tobj, FSO

         Set FSO = CreateObject("Scripting.FileSystemObject")

         Set tobj = FSO.OpenTextFile("C:\SampleText.txt",1)

          Do Until tobj.AtEndOfStream

           content = tobj.Readline

          Msgbox content

         Loop

         Set tobj = Nothing

         Set FSO = Nothing

        End Sub

         

  • sanjay0288's avatar
    sanjay0288
    Frequent Contributor
    Hi,

    Using wText i was able to fetch the entire string present in the text file. I need to validate only if string xyz is present or not. How to do that?