vinay.krishna
New member
- Joined
- Jun 23, 2015
- Messages
- 1
- Reaction score
- 0
- Points
- 0
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
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