Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 12, 2009, 04:56 PM   #1
hackthat
macrumors newbie
 
Join Date: Feb 2009
Applescript can't tell excel to open a workbook

I don't ask questions of forums without spending a great deal of time searching for answers first. But this one seems so easy yet it hasn't worked after hours of searching

I wan excel to open a workbook. I have excel 2004 and OSX

my code is

tell application "Microsoft Excel" to open workbook workbook file name "HD:User:internesktop:learningAS:SL__FORECAST.xls" with read only

the error I get is from excel saying
"SL__FORECAST.xls" cannot be accessed the file may be read-only, or you may be trying to access a read only location. Or the server the document is stored on may not be responding. "

I've tried it with "read only", and without. Tried it with different files that have been local and on a server. I've tried it with excel open and closed. I've tried changing the permissions on the file to be world read-writeable. I've tried all kinds of different syntax modifications among them:

tell application "Microsoft Excel" to open "HD:User:internesktop:learningAS:SL__FORECAST.xls

I keep getting the same error. Does applescript run as some kind of funny user?

thanks in advance,
-matt

"Applescript is so easy it's like writing in english" <-- ********
hackthat is offline   0 Reply With Quote
Old Feb 12, 2009, 09:38 PM   #2
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
Yeah, I have the same problem with Excel files. Dunno why it does that but there is definitely a problem there (my files are not password protected and they reside on my local drive, and the same thing happens even with a new, blank .xls or .xlsx doc).

But, you can get around it like this, using the UNIX open command:

Code:
do shell script "open -a /Applications/Microsoft\\ Office\\ 2008/Microsoft\\ Excel.app ~/Desktop/test.xls"
(Make sure this command is NOT inside your tell block to Excel). Obviously, adjust your paths for the application and file as necessary (or build the path as a string). This should open any doc just as if you double-clicked it in the Finder, and will open the Excel documents that AppleScript won't directly.
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Can't get connect360 to open. joshuarobi Mac Applications and Mac App Store 3 Sep 25, 2013 06:12 AM
quicksilver can't get it to open with apple+space rhagen Mac Applications and Mac App Store 17 Jun 25, 2007 03:04 AM
Tell Firefox to Open .dmg Files MacBytes MacBytes.com News Discussion 9 Dec 11, 2005 09:16 AM
can't get docs to open with version i want. toaster_oven Mac Applications and Mac App Store 3 Nov 6, 2005 05:58 PM
HELP! Can't get files to open when dragging to the dock in Tiger 10.4.1 jslicer OS X 4 May 31, 2005 02:42 PM


All times are GMT -5. The time now is 11:14 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC