2013-11-28 175 views
0

我想直接在幻燈片放映模式下打開幻燈片。我想使用的代碼是這樣的:在幻燈片放映模式下打開幻燈片演示

Process.Start("powerpnt", "/s "str_Presfileopen) 

「str_Presfileopen是一個包含文件

的路徑的字符串但這不起作用。它表示逗號')'或預期的有效表達延續。

我試圖在使用過程中啓動信息:

Dim Presfileopen As New ProcessStartInfo() 
Process.Start("powerpnt", "/s " Presfileopen) 

但是,這並不正常工作。這裏也表示逗號')'或預期的有效表達延續。

我到底在做什麼錯? 作爲我在直接代碼中編寫的一個測試,這個工程可行,但我不能這樣做,因爲我需要用戶從列表中選擇文件。 的作品代碼:

Process.Start("powerpnt", "/s ""a.pptx") 

回答

1

您需要連接在一起使用&+運營商的字符串。你也需要把周圍的引號,如果文件名包含空格:

Process.Start("powerpnt", "/s """ & str_PresFileOpen & """") 
+0

這個工程,但一旦我在幻燈片模式下打開演示文稿,我不能打開另一個沒有關閉前一個。有沒有辦法解決這個問題? –

0
Imports Microsoft.Office.Interop 

Module Module1 

Sub main() 

    Dim pptPres As PowerPoint.Presentation 
    Dim pptApp As PowerPoint.Application 
    Dim file As String 

    file = "C:\myfile.ppsm" 'example location/file' 

    pptApp = CreateObject("PowerPoint.Application") 
    pptApp.Visible = True 
    pptPres = pptApp.Presentations.Open(file) 

End Sub 
End Module 

確保顯示屬性設置爲只讀。