+ Reply to Thread
Results 1 to 17 of 17

How to Read text from already Opened Notepad

  1. #1
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    How to Read text from already Opened Notepad

    Hi All,

    I am trying it from a long time and not able to solve it, i am a bit new to the VBA

    My issues is:
    I have a notepad which is already open and i have to read the text and analysis, (the notepad dosen't have any location as it is downloaded from a website)
    i have tried creating a object with "Shell("Notepad", vbNormalFocus)", but by doing so it opeining
    even tried using createobject, but is of no use
    "Set obj = CreateObject("notepad.application")
    Set objnotepad = obj.Windows(1).text"

    Any help on this is really appreciated
    Thanks in advancd

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    Why? It's much easier to save it and read it from disk

  3. #3
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Actually i am downloading the textfile from a website through vba and i tried saving it but not able to save to local system a i am not able to click the saveas button in IE 11 version, so the alternative is to open the text file and process it

    If any suggestion on this will be greatly helpfull, i am trying it from past 5 hours but not able to crack if

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    You shouldn't be using IE to download files so I think you've gone off track - please post the code you have

  5. #5
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Below is my code, at the end of the macro a text file will open

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    I mean the bit before that - I don't want to see the nasty IE hacking

    There are multiple ways t download a text file, here are more ways than you can shake a stick at http://stackoverflow.com/questions/1...nload-file-vb6

  7. #7
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Before that is am navigating to the webpage and searching the required test, below is the full code for your reference, let me know if you need any thing else

    Please Login or Register  to view this content.
    Last edited by [email protected]; 11-23-2015 at 12:15 PM.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  9. #9
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    the website "pubmed" can be considered as reference for it

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    So you're extracting data from pubmed?

  11. #11
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Yes, can't i do that, its a public source right the best to my knowledge

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    Yes, there's not problem but they offer an API, so why would you want to download files like this? Have a look here: http://www.excelforum.com/excel-prog...se-pubmed.html

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad


  14. #14
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Actually this is a part of flow that need to be incorporated, what i have is that i need to provide a platform where user will navigate to pubmed webpage their user will search and select particular criteria's then click the button to download, then marco need to run and extract the data in notepad and save it to the local desktop, there are many search type which cannot be controlled,

    but thanks alot for sharing that post, will have a look into in,
    but if any help on it, will be use-full for me, either how to click on save-as button in IE11 and above or to extracted text from already open notepad

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Read text from already Opened Notepad

    Your code isn't doing as you describe, it's searching on behalf of the user - not allowing them to search on pubmed?

    If what you describe is what you need, (rather than what your code does) then why not simply allow the user to choose a text file to work with after they've saved it? - They can simply use the built in dialogs then

  16. #16
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Below is the file with a small part of the big picture
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    07-26-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to Read text from already Opened Notepad

    Leaving for the day, will look in HTML query tomorrow, thanks for you help Kyle, really appreciate it,

    and if you have any suggestion for my question "How to Read text from already Opened Notepad",, will be helpful

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 10-16-2014, 01:30 PM
  2. [SOLVED] Checking to see if a file has been opened in Read/Write or Read Only
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2014, 09:16 AM
  3. how to copy selected notepad text and paste it in other notepad with macro
    By Guru232 in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 04-24-2013, 04:43 AM
  4. How to save the opened word document as a Notepad/text file?
    By Rahul888 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-10-2012, 05:38 PM
  5. stop excel file opened as read only if already opened by another u
    By bobm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-09-2011, 08:45 AM
  6. Specify size and location on screen of Notepad opened by VBA?
    By proepert in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-17-2010, 08:01 PM
  7. Paste into opened notepad file
    By oOpsy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2005, 09:00 AM

Tags for this Thread

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