Solved

Launching an application from Excel 2011 on Mac using Shell command

Posted on 2014-04-17
2
73 Views
Last Modified: 2016-06-05
I'm trying to work out how to launch an application on a mac from Excel 2011.  On Windows 7 using the shell command in Excel 2010 does the job perfectly. The only response I get on the mac is that the path can't be found.
I have a simple application called GetPath that lives on the desktop. I use the following code:

Shell "Macintosh HD:Users:MyName:Desktop:GetPath"

Is it a possibility that for some reason the hard drive has another name? and if so, how can I find out?
Any help would be greatly appreciated.
0
Comment
Question by:pvman
2 Comments
 

Accepted Solution

by:
pvman earned 0 total points
ID: 40008890
The only thing I need to achieve is to launch the GetPath application that resides on the desktop. I have created a macro enabled Excel 2011 workbook that also resides on the desktop.
I have created the following macro in this workbook:

Sub startGetPath()
  Dim s As String
 
  s = ThisWorkbook.Path
  MsgBox s
  s = s & ":GetPath"
  Shell (s)
End Sub

The message displayed is:  Macintosh HD:Users:pvman:Desktop
(pvman being my user name)
This by the way settles the issue about the name of the hard disk that I mentioned in my earlier post.
My simple minded assumption was that adding :GetPath to ThisWorkbook.Path would get me to the GetPath application, only to be told that there is a runtime error 53 and that the file can't be found. I can categorically state that a file with that name exists on the desktop and I can run it from there by double clicking on it.
From searches on the internet I found out that the Excel 2011 Shell function
- requires the full path
- requires the colon as path separator
- does not tolerate additional parameters, unlike the Windows version
Having met these conditions as far as I can make out, I am at a loss as to why the Shell function doesn't work as expected or are there more dark secrets lurking beneath the surface.
I am very familiar with the Windows environment but not at all with Apple script and that is why I am focussing on using the Shell function, if at all possible.
I would be very grateful if there is anyone who can shed light on this issue.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Viewers will learn the different options available in the Backstage view in Excel 2013.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question