簡體   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