Hello,
I've been working through this macro all day (with the help of the board) and I'm almost there. The macro opens a text file (into a new workbook) and performs a lot of formatting on the file. I'm now trying to get the macro to ask the user to SaveAs, but I keep getting a "Method 'SaveAs" of object '_Workbook failed". Below is the beginning and end of the macro (basically the opening the text file and close the excel file portions). Please let me know if I should post more of the code. Thanks!
Beginning
End of Macro
Not sure what the problem is..any help is greatly appreciated.
I've been working through this macro all day (with the help of the board) and I'm almost there. The macro opens a text file (into a new workbook) and performs a lot of formatting on the file. I'm now trying to get the macro to ask the user to SaveAs, but I keep getting a "Method 'SaveAs" of object '_Workbook failed". Below is the beginning and end of the macro (basically the opening the text file and close the excel file portions). Please let me know if I should post more of the code. Thanks!
Beginning
Code:
TextFileName = Application.GetOpenFilename _
("Text Files (*.txt), *.txt", , "Select File", , False)
Workbooks.OpenText Filename:= _
TextFileName, Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2), Array(8, _
2), Array(39, 1), Array(45, 1), Array(68, 1), Array(88, 1), Array(108, 1), Array(148, 1), _
Array(155, 1), Array(178, 1), Array(198, 1), Array(218, 1), Array(238, 1), Array(245, 1), _
Array(268, 1), Array(288, 1), Array(308, 1), Array(328, 1), Array(335, 1), Array(358, 1), _
Array(378, 1), Array(398, 1), Array(418, 1)), TrailingMinusNumbers:=False
End of Macro
Code:
SaveFileName = Application.GetSaveAsFilename _
("Excel Files (*.xls), *.xls", , "Name This File", , False)
ActiveWorkbook.SaveAs Filename:=SaveFileName
Not sure what the problem is..any help is greatly appreciated.