Reputation: 13
Can somebody please tell me what is wrong with the following applescript
set sourceFile to (choose file with prompt "Choose source files" of type {"XLS6", "XLS7", "XLS8", "XLS", "TXT"} with multiple selections allowed without invisibles)
tell application "Microsoft Excel"
-- activate
open workbook workbook file name sourceFile
end tell
I am getting the following error
error "Microsoft Excel got an error: Can’t continue open workbook." number -1708
The script works if I hard code an individual file path, so problem must be in the set sourceFile line, but I need to be able to choose a file as it will not always be the same.
Upvotes: 1
Views: 1334
Reputation: 11238
Try this:
set sourceFile to (choose file with prompt "Choose source files" of type {"XLS6", "XLS7", "XLS8", "XLS", "TXT"} with multiple selections allowed without invisibles) as string
tell application "Microsoft Excel"
open sourceFile
end tell
Upvotes: 3