Hi
I have a issue again, i have changed the code slightly according to my staff's requirements and due to that the data has been not copied to the text file but it has successfully created the text file, please find the below code which i have used.
Sub Import_PMSData()
'
' Import_PMSData Macro
' Macro to import data's of Planning Management Report.
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
Dim ws As Worksheet
Set ws = ActiveSheet
Sheets("PMS All").Select 'If remove this condition it is copiying the data to the text file.
Range("P3:DK903").Select
Selection.ClearContents
Range("P3").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
Range("P3").Select
Application.ScreenUpdating = False
Sheets.Add.Move
With ActiveWorkbook.Sheets(1)
ws.Range("P3:DK903").Copy
.Range("A1").PasteSpecial xlPasteValues
.SaveAs Environ("UserProfile") & "\Desktop\" & Format(Now, "dd-mmm-yyyy hh_mm_ss AM/PM") & ".txt", xlUnicodeText
.Parent.Close False
End With
Application.ScreenUpdating = True
Sheets("Home").Select
Range("J5").Select
Selection.Copy
Range("J23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("K5").Select
End Sub
Please help me in this issue and please be noted that the workbook which we are using this code is shared.
Bookmarks