I have an Excel worksheet from which I need to export range, A:1 to last used cell in column A, to an xml file. How do you set the exported file name to be the same as the file I exported from?
Sub exportxmlfile()
Dim myrange As Range
Worksheets("xml").Activate
Set myrange = Range("A1:A20000")
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\exports\2012\test.xml", True)
For Each c In myrange
a.WriteLine (c.Value)
Next c
a.Close
End Sub