I am trying to open a text file in Microsoft Excel 2001 because I need to work with text files that have four columns, and the text file need to be sorted using the 3rd column. I’m pretty sure this can be done without Excel, but scripting it may be a bit too difficult for me, so I tried to use Excel. However, I’m already stuck at reading the text file into Excel. This is what I have so far:
property Default_Location : (path to home folder as Unicode text) as alias
tell application "Finder"
try
set selectedFile to choose file default location Default_Location with prompt "Choose the text file."
on error
display dialog "An error occurred or script was cancelled."
end try
tell application "Microsoft Excel"
activate
open selectedFile
end tell
end tell
Error that is displayed is: “Microsoft Excel got an error ‘’ could not be found”. I’m probably doing something very basic wrong, so if someone could tell me what it is, that would be great. By the way, I’m using Tiger (10.4.11).
Never mind… I googled around a bit more and at last found a way to do it…