Excel VBA Code referencing C:\ not recognized by MAC

B

BEEJAY

Greetings:

Am having to set up Add-Ins onto new (Mac) computer.
My programming uses a lot of references to pathes ......
ie: C:\Contract Templates; C:\Add_Ins; etc..................
The Mac does not seem to pick this up when the add-ins are installed in its
root.

How can Mac be set up to recognize those pathes?
Will the coding have to be reworked? if so, how should the above read?
 
J

John McGhie

Yes, you will have to rework your code.

Both Mac and Windows use Named volumes to refer to disks. Windows fell into
a habit of "naming" its volumes with simple letters of the alphabet, because
it was shorter to type, back in the days when you had to type them.

But on both Windows and Mac, you can name a drive as "MyData" or Mac HDD" or
simple "C" if you like. In Finder, go to the top of the tree and click on
your computer name. It will then tell you what your mounted volumes are
named. If you haven't changed it, the system volume will be named "Mac
HDD". And you can change it if you wish: internally the OS uses an
identifier to keep track of them.

It's the back-slashes that are doing the damage. Mac OS is a Unix operating
system, and backslashes are not allowed in file names. Convert them to
forward slashes and they will work on either Mac or Windows.

While you are re-arranging things, you should correct another problem that
will give you problems both sides of the fence: you should not store things
in the Root of any drive: leave that clear for the system.

If your items are to be personal to the user, but them in the user's
Documents (or "My Documents" on Windows) folder.

If the items are parameter files, not data, they should go into:
/Users/~/Library/Application Support/Microsoft

Where "~" stands for "The home folder of the logged-in user".

To make them available to all users of the computer, put them in:
/Users/Shared

In each case, create proper folders within those destinations for whatever
it is you are storing. Good housekeeping is not essential on the Mac, but
it can save you a hell of a lot of time and trouble years down the track
when you come to handle a problem.

Like everyone else's, my system has at least one folder that is a graveyard
for all the "seemed like a good idea at the time and now I can't remember
what it is for" kinds of "stuff". Just try not to have too many of them :)

Hope this helps

Greetings:

Am having to set up Add-Ins onto new (Mac) computer.
My programming uses a lot of references to pathes ......
ie: C:\Contract Templates; C:\Add_Ins; etc..................
The Mac does not seem to pick this up when the add-ins are installed in its
root.

How can Mac be set up to recognize those pathes?
Will the coding have to be reworked? if so, how should the above read?

--

Mactopia is currently broken: the helpers are not seeing any of the
questions being posted. Microsoft is working on the problem. In the
meantime:

To successfully post in here, either use Google:
http://groups.google.com/group/microsoft.public.mac.office.word?lnk=

Or Microsoft Communities:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=micros
oft.public.mac.office.word&cat=en_US_3cf8ecf1-ca81-4391-b07d-8933029ee8a9&la
ng=en&cr=US

Or in Entourage, use the pre-configured Microsoft News server:
See "setting up Entourage for Newsreading" here:
http://word.mvps.org/Mac/AccessNewsgroups.html

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 
J

JE McGimpsey

BEEJAY said:
Greetings:

Am having to set up Add-Ins onto new (Mac) computer.
My programming uses a lot of references to pathes ......
ie: C:\Contract Templates; C:\Add_Ins; etc..................
The Mac does not seem to pick this up when the add-ins are installed in its
root.

How can Mac be set up to recognize those pathes?
Will the coding have to be reworked? if so, how should the above read?

Since default paths are different between platforms, you'll probably do
best to hard code a path.

One way is to use conditional compilation:

#If Mac Then
sContractTemplatePath = "Mac HD:Contract Templates"
#Else
sContractTemplatePath = "C:\Contract Templates"
#End If


If you need a user independent method on a Mac, you can use AppleScript:

sHomeFolderPath = MacScript("(path to home folder as string)")
sDocFolderPath = MacScript("(path to documents folder as string)")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top