Stuck - code working in windows but not on mac (error 68)

LT1511

New Member
Joined
Jul 31, 2012
Messages
10
The code below does the following perfectly in Windows
1) automatically creating a folder structure based on entry in Column 3; and
2) automatically creating a hyperlink in the appropriate column.
The code can be found below:

Code:
 If Not Intersect(Target, Columns(3)) Is Nothing Then
    Dim tr As String
    With Target
        tr = ThisWorkbook.Path & "\" & .Offset(, -2).Value
        If Len(Dir(tr)) = 0 Then
            MkDir tr
            MkDir tr & "\Folder 1"
            MkDir tr & "\Folder 2"
            MkDir tr & "\Folder 2" & "\Subfolder1"
            MkDir tr & "\Folder 2" & "\Subfolder 2"
            .Hyperlinks.Add .Offset(, 4), tr, TextToDisplay:="NAME"
        End If
    End With
End If
 
End Sub

I have been trying to get this to work on Mac but I always get and error 68 and then debugger opens on line
If Len(Dir(tr)) = 0 Then

I have tried changing the \ in tr and mk dir
to
using :
using \
using " " (basically empty space)
I tried changing "(denominator)" to application.pathseparator - still nothing.
I can only make this work if I remove the line

If Len(Dir(tr)) = 0 Then

Any thoughts? I am totally perplexed by this - there must be a way of maintaining this line?
Luke
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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