使用excel vba在macintosh上打开简报

我在这个话题上做了大量的研究,似乎找不到任何对我有用的东西。 我的项目所做的是用户用数据填充excel文件。 用户按下excel数据的完成,并自动填充到一个简报。 这个叫“ExcelUseThisOne”的简报已经存在,并保存在桌面上的一个文件夹(称为“PowerPoint”)中,我想让excel文件打开幻灯片,自动填充,保存,然后closures幻灯片。这在PC上工作,但不是在Mac上。这是我的代码,我认为会工作,但不是:

UserName = InputBox(Prompt:="You name please.", Title:="ENTER YOUR NAME", Default:="all LOWERCASE and ONE WORD") Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String strPresPath = ":Users:" & UserName & ":Desktop:PowerPoint:ExcelUsesThisOne.ppt" FilePath = ":Users:" & UserName & ":Desktop:PowerPoint:NewPresentation.ppt" strNewPresPath = FilePath Set oPPTApp = CreateObject("PowerPoint.Application") oPPTApp.Visible = msoTrue Set oPPTFile = oPPTApp.Presentations.Open(strPresPath) 

任何帮助将是伟大的! 谢谢。

我不确定,但我似乎记得,Mac不使用文件扩展名,所以你可以在Mac上试试这个:

 strPresPath = ":Users:" & UserName & ":Desktop:PowerPoint:ExcelUsesThisOne" 

其他可能的原因是用户名input不正确? 我认为这将工作在Mac,而不是input框,你可以尝试其中的一个选项:

 strPresPath = ":Users:" & Environ("username") & ":Desktop:PowerPoint:ExcelUsesThisOne" 

或者使用文件扩展名尝试这种方法(同样,我不能100%确定Mac OS上未使用的文件扩展名)。

您可能需要卷名,例如:

 strPresPath = "volume_name:Users:..."` 

否则,您可以通过检查其他工作簿的path进行debugging,这应该会显示出制定pathstring的正确方法。

祝你好运!