Bob
I need help with a macro. The macro runs automatically, imports a .txt file, then saves the worksheet with a new name.
Problem is, when I open the new worksheet the macro tries to run again. Here's what I have:
Sub Auto_Open()
'
' Auto_Open Macro
'
'
Range("A2:F2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;c:\xxxxxxx\xxxxxx\users\xxxxxxx\xxxx.txt", Destination:=Range("A2"))
.Name = "sy060z1_14"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 9, 9, 1, 1, 1, 9)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.SaveAs Filename:="c:\xxxxxxx\xxxxxx\users\xxxxxxx\xxxx.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.RunAutoMacros Which:=xlAutoClose
Application.Quit
End Sub
I need to make the macro delete itself, then resave the file under a new name. I don;t know if this is even possible, since it's still running. Can someone help me out with this?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic