VBA folder and path object for Mac

MVD100

New Member
Joined
Dec 6, 2010
Messages
9
I currently have an Excel file with VBA made with Excel 2002 for Windows. I use VBA to import data from .cvs files on another computer running Windows XP. If you read my other recent post you will see what I am doing. Now I have a user that wants to use it on a Mac running Excel 2004 for the Mac. However, it fails when it gets to the following code:
Code:
Set appShell = CreateObject("Shell.Application")
Set oFolder = appShell.Namespace((strpath))
I know ActiveX is not comaptible with the Mac. Is there a way to set the folder object in VBA for Mac? I was thinking of using a test like this:
Code:
'   Test for Macintosh OS
    If Not Application.OperatingSystem Like "*Mac*" Then
      Set appShell = CreateObject("Shell.Application")
      Set oFolder = appShell.Namespace((strpath))
    Else
        ' do something here for Mac object
    End If
Is there a method I can use that is not ActiveX that can search through a folder and run on Windows and Mac?
Thanks.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Dir should work on both OS.
 
Upvote 0
I am not sure what to think of using Dir. I am using set and CreateObject. On the Mac the VBA fails stepping into:
Code:
Set appShell = CreateObject("Shell.Application")
Is there a Mac VBA equivalent to this?
 
Upvote 0
You asked for a method to search through a folder. Dir does that and works on both systems.
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,220
Members
452,895
Latest member
BILLING GUY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top