[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]I have an excel file with a template to write it in Notepad with certain format,[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]
[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]And the Output in notepad is,[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]
[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]Below is the code which I tried and also got help from stack overflow, but I am not able to compose the notepad with the template.
[/COLOR]
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub Characterpostion()
Dim FilePath As String
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
Dim str As String
Dim cellvalue As String
LastCol = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column
LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
FilePath = FreeFile
'CellData = ""
Open "C:\Users\Antony\Music\Excel Macros\Text2.txt" For Output As #2
With ActiveSheet
For k = 2 To LastRow
str = Join(Application.Transpose(Application.Transpose(.Cells(k,
"A").Resize(1, LastCol).Value)), "@#")
str = Replace(str, "=", vbNullString)
Print #2 , str
Next k
End With
Close #2
End Sub
</code>[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]Need help to create a template from Excel to Notepad with exact character positions.[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]And the Output in notepad is,[/COLOR]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]
[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]Below is the code which I tried and also got help from stack overflow, but I am not able to compose the notepad with the template.
[/COLOR]
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub Characterpostion()
Dim FilePath As String
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
Dim str As String
Dim cellvalue As String
LastCol = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column
LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
FilePath = FreeFile
'CellData = ""
Open "C:\Users\Antony\Music\Excel Macros\Text2.txt" For Output As #2
With ActiveSheet
For k = 2 To LastRow
str = Join(Application.Transpose(Application.Transpose(.Cells(k,
"A").Resize(1, LastCol).Value)), "@#")
str = Replace(str, "=", vbNullString)
Print #2 , str
Next k
End With
Close #2
End Sub
</code>[COLOR=[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] 42729]Need help to create a template from Excel to Notepad with exact character positions.[/COLOR]
Last edited by a moderator: