Creating A Text File From Single Column Via Macro
Woudl it be possible to write the whole Macro with that functionality
in it please? I have tried this:
Sub ExportToPRN()
Dim FName As String
Dim WholeLine As String
Dim FNum As Integer
Dim myRange As Range
Dim myCell As Range
Dim myName As String
Dim Cell As Range
Dim OutputDir As String
myName = ActiveWorkbook.FullName
FName = Application.GetSaveAsFilename( _
Replace(myName, ".xls", ".prn"))
On Error GoTo EndMacro:
FNum = FreeFile
Open FName For Output Access Write As #FNum
Set myRange = Range("C1:C2")
WholeLine = ""
For Each myCell In myRange
WholeLine = WholeLine & "\" & myCell.Text & vbNewLine
MkDir OutputDir & Cell.Value
Next myCell
WholeLine = Left(WholeLine, Len(WholeLine) - 1)
Print #FNum, Trim(WholeLine)
EndMacro:
On Error GoTo 0
Close #FNum
End Sub
But have had no success. What am I doing wrong?
|