vba file path hitch

G

Gary Hillerson

In vba, I'm trying to access a file that is stored in the System
Folder:preferences folder of the user's computer. I need to be able to
find the file on any user's Mac.

I wanted a function that simply gives me the name of the system drive
or the path to he System Folder:preferences folder, but couldn't find
one.

Instead, I tried using Application.StartupPath, then picked the drive
name out of that path. But the path name being returned by StartupPath
has lowercased the entire path, which means I can't use it for opening
the file.

For example, on my test computer, the hard drive is named "GaryDrive,"
but Application.StartupPath returns "garydrive" instead.

Is there a way to get the correct path to the System
Folder:preferences folder on a Mac??

thanks in advance,
gary
 
J

JE McGimpsey

One way:

Const sAScript As String = "Tell application ""Finder""" & _
vbNewLine & "return name of startup disk" & vbNewLine & _
"end tell"
Const sPath As String = ":System Folder:preferences:"
Dim sVolumeName As String
sVolumeName = MacScript(sAScript) & sPath
 

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