+ Reply to Thread
Results 1 to 3 of 3

Paste into opened notepad file

  1. #1
    Registered User
    Join Date
    11-27-2005
    Posts
    11

    Paste into opened notepad file

    May i know how do i continue from my code below in order to allow me to copy sheet3 cells A1:A42 into the opened file? I am able to call notepad to open the .xml file but i need to paste the data from excel into this opened file.Thanks!!

    Private Sub CommandButton1_Click()
    Shell "C:\Windows\Notepad.exe 'C:\project\fyp1.xml"

    End Sub

  2. #2
    Registered User
    Join Date
    11-27-2005
    Posts
    11
    any kind soul able to help?

  3. #3
    Charlie
    Guest

    Re: Paste into opened notepad file

    I don't know how to paste the clipboard contents into another spawned process
    as you want. There may be a way to do it, but I would suggest reading about
    opening/closing/reading/writing to text files in VB help.

    You don't say where you want to paste the cell contents in the file. Below
    are two examples. The first one appends the cells to the end of the file.
    The second one appends each cell to the end of each line of the text file,
    assuming there is one line for each cell.

    I did not test these examples, they are simply to give you an idea how to
    get started.

    ' Method 1 - append to end of file

    Dim Cell As Range

    Open "C:\project\fyp1.xml" For Append As #1

    For Each Cell In Sheets("Sheet3").Range("A1:A42")
    Print #1, Cell.Text
    Next Cell

    Close #1

    ' Method 2 - append to end of each line of file

    Dim Rec As String
    Dim nRec As Long

    Open "C:\project\fyp1.xml" For Input As #1
    Open "C:\project\fyp1_NEW.xml" For Output As #2

    Do While Not EOF(1)
    Line Input #1, Rec
    nRec = nRec + 1
    Print #1, Rec & Sheets("Sheet3").Cells(nRec, 1).Text
    Loop

    Close #1
    Close #2


    "oOpsy" wrote:

    >
    > any kind soul able to help?
    >
    >
    > --
    > oOpsy
    > ------------------------------------------------------------------------
    > oOpsy's Profile: http://www.excelforum.com/member.php...o&userid=29132
    > View this thread: http://www.excelforum.com/showthread...hreadid=489798
    >
    >


+ 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