0
Mac (Excel 2015)에서 파일 선택 대화 상자를 열고 경로를 반환하는 기능이 있습니다. 아래 코드는 있지만 코드가 아니라 경로가 문제라고 생각하며 직접 디버깅 할 Mac이 없습니다. 함수에 의해 반환되는 경로는 다음과 같습니다Excel VBA - Mac에서 파일을 찾을 수 없습니다.
SSD : 사용자 : 사용자 이름 : 다운로드 : .csv로 출퇴근 수출 (40)
나는 수정했습니다 : 사용자 이름 :하지만 제대로 쇼 사용자를 않습니다 . 파일이 위치에 존재, 나는 나에게 경로를 보낼 수있는 사용자를 물어 그들은 보내
/사용자/사용자 이름/다운로드/작업 표 - 수출 (40)
Function GetFileMac()
Dim myPath As String
Dim myScript As String
Dim myFiles As String
Dim mySplit As Variant
Dim n As Long
Dim fName As String
Dim myBook As Workbook
On Error Resume Next
myPath = MacScript("return (path to documents folder) as String")
myScript = _
"set applescript's text item delimiters to "","" " & vbNewLine & _
"set theFiles to (choose file of type " & _
" {""com.microsoft.excel.xls"",""public.comma-separated-values-text""} " & _
"with prompt ""Please select the time sheet file"" default location alias """ & _
myPath & """ multiple selections allowed false) as string" & vbNewLine & _
"set applescript's text item delimiters to """" " & vbNewLine & _
"return theFiles"
myFiles = MacScript(myScript)
On Error GoTo 0
If myFiles <> "" Then
mySplit = Split(myFiles, ",")
GetFileMac = mySplit(0)
End If
End Function
을 .csv로
내가이 프로그램을 실행할 때, 나는 오류를 전혀 발견 1004 파일을 얻을 수 있지만, 포착 된 경로 위에 언급 된 바와 같이 FP 문자열로 볼 수 있습니다 :
Dim fp as string
' if user on Mac etc... then
fp = GetFileMac
Set someWorkbook = Application.Workbooks.Open(fp) ' error here