我想在幻灯片模式下直接打开powerpoint。我试图使用的代码如下:
Process.Start("powerpnt", "/s "str_Presfileopen)'str_Presfileopen是一个包含文件路径的字符串
但这不管用。它说逗号‘’或一个有效的表达式继续期望。
我尝试使用过程开始信息:
Dim Presfileopen As New ProcessStartInfo()
Process.Start("powerpnt", "/s " Presfileopen)但这也不起作用。这里它也说逗号‘)或一个有效的表达式继续期待。
我到底做错什么了?作为一种测试,我用直接代码编写了它,但是我不能这样做,因为我需要用户从列表中选择文件。起作用的代码:
Process.Start("powerpnt", "/s ""a.pptx")发布于 2013-11-28 15:08:11
您需要使用&或+运算符将字符串连接在一起。如果文件名包含空格,则还需要在其周围加上引号:
Process.Start("powerpnt", "/s """ & str_PresFileOpen & """")发布于 2016-12-08 07:30:59
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 确保表示属性设置为只读。
https://stackoverflow.com/questions/20269105
复制相似问题