A
Aidan Gullickson
I am having problems with an Excel macro that was originally written
on a Windows machine. This macro works completely fine on a Windows
computer, but gives back all kinds of error messages on any Mac. Here
is the full text of the macro. Does anyone have any suggestions?
Thanks.
Windows("convert NES headers.xls").Visible = False
' Generate an "Open File" window for the user to select the NES header
files
fNameArray = Application.GetOpenFilename("Text Files (*.txt),
*.txt", MultiSelect:=True)
' Loop through each file and perform a Text to Columns import
For Each fName In fNameArray
Workbooks.OpenText Filename:= _
fName, Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False _
, Comma:=True, Space:=False, Other:=False,
FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2),
Array(6, 2), Array(7, 2), Array(8, 2), _
Array(9, 2))
' Delete the top "comment" row created by the first comment line in
the NES header file
Rows("1:2").Select
Selection.Delete Shift:=xlUp
' Build the spreadsheet filename from the NES header filename: take
current filename minus
' the ".txt" and replace with ".xls"
Dim newfName, position, newfNameandType
position = (fName,".txt")
newfName = Left(fName, position - 1)
newfNameandType = newfName + ".xls"
ActiveWorkbook.SaveAs Filename:=newfNameandType,
FileFormat:=xlNormal
ActiveWindow.Close
Next
MsgBox "Conversion of NES headers complete."
Windows("convert NES headers.xls").Close False
End Sub
on a Windows machine. This macro works completely fine on a Windows
computer, but gives back all kinds of error messages on any Mac. Here
is the full text of the macro. Does anyone have any suggestions?
Thanks.
Windows("convert NES headers.xls").Visible = False
' Generate an "Open File" window for the user to select the NES header
files
fNameArray = Application.GetOpenFilename("Text Files (*.txt),
*.txt", MultiSelect:=True)
' Loop through each file and perform a Text to Columns import
For Each fName In fNameArray
Workbooks.OpenText Filename:= _
fName, Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False _
, Comma:=True, Space:=False, Other:=False,
FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2),
Array(6, 2), Array(7, 2), Array(8, 2), _
Array(9, 2))
' Delete the top "comment" row created by the first comment line in
the NES header file
Rows("1:2").Select
Selection.Delete Shift:=xlUp
' Build the spreadsheet filename from the NES header filename: take
current filename minus
' the ".txt" and replace with ".xls"
Dim newfName, position, newfNameandType
position = (fName,".txt")
newfName = Left(fName, position - 1)
newfNameandType = newfName + ".xls"
ActiveWorkbook.SaveAs Filename:=newfNameandType,
FileFormat:=xlNormal
ActiveWindow.Close
Next
MsgBox "Conversion of NES headers complete."
Windows("convert NES headers.xls").Close False
End Sub