Robinstwitcher
Programmer
Am trying to save multiple worksheets within a workbook as a tab delimited file. However with the following code it saves multiple files with the correct sheet name, but only the data from Sheet1 (i.e. doesn't save the data from all the seperate worksheets)
Private Sub CommandButton2_Click()
Dim ws As Worksheet
ThisWorkbook.Save
For Each ws In ActiveWorkbook.Worksheets
MName = ws.Name & ".txt"
MDir = ActiveWorkbook.Path
ActiveWorkbook.SaveAs Filename:=MDir & "\" & MName, FileFormat:= _
xlText, CreateBackup:=False
Next ws
End Sub
Private Sub CommandButton2_Click()
Dim ws As Worksheet
ThisWorkbook.Save
For Each ws In ActiveWorkbook.Worksheets
MName = ws.Name & ".txt"
MDir = ActiveWorkbook.Path
ActiveWorkbook.SaveAs Filename:=MDir & "\" & MName, FileFormat:= _
xlText, CreateBackup:=False
Next ws
End Sub