繁体   English   中英

在macintosh上使用excel vba打开powerpoint

[英]opening powerpoint using excel vba on a macintosh

我对此主题进行了大量研究,但似乎找不到适合我的方法。 我的项目所做的是用户用数据填充excel文件。 用户按下完成按钮,这将获取excel数据并将其自动填充到PowerPoint中。 简报“称为“ ExcelUseThisOne”)已经制作好并保存在桌面上的文件夹(称为“ PowerPoint”)中。我希望excel文件打开简报,自动填充它,保存,然后关闭简报。可以在PC上使用,但不能在Mac上使用。这是我打开Powerpoint的代码,我认为该代码可以运行,但无效:

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:

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

其他可能的原因是用户名输入错误? 我认为这将在Mac上运行,而不是输入框,您可以尝试以下选项之一:

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

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

您可能需要卷名,例如:

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

否则,您可以通过检查其他工作簿的路径来进行调试,这将向您显示正确的方式来构造路径字符串。

祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM