在幻灯片模式下打开Powerpoint演示文稿

时间:2013-11-28 14:52:15

标签: vb.net process slideshow powerpoint

我想直接以幻灯片模式打开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")

2 个答案:

答案 0 :(得分:1)

您需要使用&+运算符将字符串连接在一起。如果文件名包含空格,您还需要在其周围加上引号:

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

答案 1 :(得分:0)

CMD . /venvs/myenv3.5/bin/activate; /bin/bash;

确保将演示文稿属性设置为只读。