OS X Excel 2011 VBA 保存文件名

OS X Excel 2011 VBA Save File Name

我需要编写一个脚本来将工作表保存到预定位置,保存名称由工作表中的值填充。我可以将其保存在正确的位置,但文件名 returns 是 FATPMetiFolderPath 和 FATPMetiPath 的组合(\Volumes\MFS1\Groups\METI...\METIman\MMP0123 - FATP.xlsm)。我可以用 Windows Excel VBA 很好地做到这一点,但我以前从未使用过 Mac。我在PC上编程,但如果在Mac.

上使用,需要能够正确保存
Sub saveFATPMMMac()

 'Saves copy for access for everyone
 Dim FATPMetiPath As String
 Dim FATPMetiFolderPath As String


 FATPMetiFolderPath = "\Volumes\MFS1\Groups\METI\Quality Control\Function and Acceptance Test Documents\METIman\"
 'FATPMetiFolderPath = "C:\Users\gzapantis\Desktop\"
 FATPMetiPath = FATPMetiFolderPath & _
    Sheets("Failure Report").Range("FailReportSN").Text & " - FATP " & ".xlsm"

 ThisWorkbook.SaveAs Filename:=FATPMetiPath

End Sub

我已经解决了问题。它使用正确的文件名将其保存在正确的位置。

Sub saveFATPMMMac()
'Saves copy for access for everyone
  Dim FATPMetiPath As String
  Dim FATPMetiFolderPath As String

 If Application.PathSeparator = ":" Then
    FATPMetiFolderPath = "Volumes:MFS1:Groups:METI:Quality Control:Function and Acceptance Test Documents:METIman:"
 Else
    FATPMetiFolderPath = "F:\Groups\METI\Quality Control\Function and Acceptance Test Documents\METIman\"
 End If

 FATPMetiPath = FATPMetiFolderPath & _
    Sheets("Failure Report").Range("FailReportSN").Text & " - FATP.xlsm"

 ThisWorkbook.SaveAs Filename:=FATPMetiPath

End Sub

感谢您为我指明了正确的方向。