Export Macro

  • Thread starter Thread starter craygo
  • Start date Start date
C

craygo

I have some date on a page. I want to have a cell where the user ca
enter a name. Then a macro to export the sheet as a .txt file with th
name that they entered in the cell.

Hope that was clear enough

Thanks

Ray:confused
 
With no error checking to make sure that there's something legal in that cell
and that you specified a valid folder/filename:

Option Explicit
Sub testme03()

ActiveSheet.Copy 'to a new workbook
With ActiveSheet
.Parent.SaveAs Filename:="c:\my documents\excel\" _
& .Range("a1").Value & ".txt", FileFormat:=xlText
.Parent.Close savechanges:=False
End With

End Sub
 
Back
Top