Ruma
New Member
Hi,
Am using a macro to copy paste data from an excel file (excel template) into a notepad.
Currently the macro is saving the notepad in a specific path, however I want the notepad to be saved in the same path where excel file/template is saved. Be it desktop or any share drive.
Please note, below is the code am currently using.
Thanks,
Ruma
Am using a macro to copy paste data from an excel file (excel template) into a notepad.
Currently the macro is saving the notepad in a specific path, however I want the notepad to be saved in the same path where excel file/template is saved. Be it desktop or any share drive.
Please note, below is the code am currently using.
Thanks,
Ruma
Code:
Public Sub CopyToNotepad()
Dim strPath As String: strPath = "\\crb.apmoller.net\pnqgscshare\BCO\06. Business Process Support\In House Cash - IHC\MT940 Automation\" & Range("E1").Value & ".txt"
Dim intFF As Integer: intFF = FreeFile()
Open strPath For Output As #intFF
Print #intFF, Join(Application.Transpose(Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Value), vbCrLf)
Close #intFF
End Sub