I have an Excel VBA code that used to work fine. After a recent Excel update, the code generates Run-time error '75':Path/File access error.
The code is supposed to open a file for output in the same location where the XLSX file is run from, in this case my DropBox.
Sub OpenKMLFile()
Dim OutputPath As String
OutputPath = ThisWorkbook.Path
If InStr(1, OutputPath, "\") >= 1 Then
'Output File Path for Windows
OutputPath = OutputPath & "\" & KMLFileName & ".kml"
ElseIf InStr(1, OutputPath, "/") >= 1 Then
'Ouotput Path for Mac with '/'
OutputPath = OutputPath & "/" & KMLFileName & ".kml"
Else
'Ouotput Path for Mac with ':'
OutputPath = OutputPath & ":" & KMLFileName & ".kml"
End If
KMLFileNumber = FreeFile()
Open OutputPath For Output As KMLFileNumber
End Sub