Results 1 to 1 of 1

Thread: Issue on exporting the values to notepad

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Post Issue on exporting the values to notepad

    Hi all,

    I have one code but it works with me perfectly unfortunately the pasted values in the cell is continuous like book pad i need to paste as per excel line by line.

    Sub NOTEPAD()
    Dim str1 As String, FileToSave As String

    FileToSave = "D:\Report.txt"
    Range("A1:A500").Copy

    'Get clipboard content and assign it to str1 variable
    With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") 'Clipboard object
    On Error Resume Next
    .GetFromClipboard
    str1 = .GetText(1)
    On Error GoTo 0
    End With

    'Write to file
    If Len(str1) Then
    Open FileToSave For Output As #1
    Print #1, str1
    Close #1
    End If
    Application.CutCopyMode = False
    End Sub

    please test the code and reply positive.

    I have attached excel sheet also.

    Thanks&Regards
    Vinay Krishna
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •