+ Reply to Thread
Results 1 to 7 of 7

vba code question in excel to manipulate notepad document

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    vba code question in excel to manipulate notepad document

    I'm using the following code to copy columns of data in a worksheet of mine. The code once activated will open "notepad" and copy the columns of data in my excel worksheet. Here is the code:
    Please Login or Register  to view this content.
    Could anyone help me (if it is possible) to edit this code so that after the data is copied in notepad that the notepad document will be saved automatically as "Analysis.txt" and then placed on the C drive closing notepad and leaving my excel spreasheet still visible? Any suggestions and or assistance would be greatly appreciated. I'm trying to simplify some time consuming elements with this code. Thanks in advance!
    Last edited by lilsnoop; 01-21-2009 at 12:19 AM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    See my post at MrExcel.

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Thanks Ken

    I'm looking at that link now trying to figure out what to add and where... Unfortunately I'm not very good with vba.. I'm trying to learn it though, but it seems at a snails pace. Thank you!

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    All you need to do is to copy what I posted and change the sub t(). Change the value of s to point to your txt file's name.
    e.g.
    Please Login or Register  to view this content.
    Insert this and the other code into a Module. Name the sub t() whatever you like.

  5. #5
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    I'm an idiot....

    Well Ken I thought I did what you said, but apparently I'm still missing something... this is what I've done:

    Please Login or Register  to view this content.
    Ideally I want to save the document as "analysis.txt" and have it placed in the following directory c:\Analysis\ Thanks for your time & help!

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You added your old routine which is not needed. Always avoid Sendkeys when you can.

    You did not include the three routines that I posted. As stated in the MrExcel thread, you also need to add the Forms reference from the Tools > Reference, as commented in the getClipboard() sub.

    The total solution would be:
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Thank You!!

    I really appreciate your help!

+ 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