如何让VB程序与其他程序连接?

来源:百度知道 编辑:UC知道 时间:2024/06/25 05:19:25
如何使用VB
比如按自己用 VB编写的小程序的按钮去打开其他文件,程序
最好生成的是一个文件!连接完后还要合并起来

可以使用OLE对象
以下是调用PPT的一个例子
非OLE对象.你可以查考一下API函数.应该可以.
Dim strTime, endTime
Private Sub Command2_Click()
MsgBox Format(endTime - strTime, "您以运行HH小时MM分SS秒"), vbInformation, "程序提示"
End Sub

Private Sub Command3_Click()
CommonDialog1.ShowOpen
OLE1.SourceDoc = CommonDialog1.FileName
OLE1.Action = DoVerb
End Sub

Private Sub Form_Load()
OLE1.SourceDoc = App.Path + "\会议材料.ppt"
OLE1.Action = DoVerb
CommonDialog1.Filter = "*.ppt|*.ppt"

End Sub

Private Sub Timer1_Timer()
If OLE1.AppIsRunning Then
strTime = Time
Timer2.Enabled = True
Timer1.Enabled = False
End If
End Sub

Private Sub Timer2_Timer()
If Not OLE1.AppIsRunning Then
endTime = Time
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub