Dim wordapp As New Word.Application
'double click the filename
wordapp.Visible = True
Call wordapp.Documents.Open("filename")
'if quit
Set wordapp = Nothing
'double click the filename
wordapp.Visible = True
Call wordapp.Documents.Open("filename")
'if quit
Set wordapp = Nothing
' Notepad:
Result = Shell("start.exe notepad", vbHide)
' E-mail:
nResult = Shell("start.exe mailto:[email protected]", vbHide)
' Internet:
nResult = Shell("start.exe http://vbtt.yeah.net", vbHide)
' Word
nResult = Shell("start.exe myfile.doc", vbHide)
' Picture Viewer
nResult = Shell("start.exe myfile.jpg", vbHide)
我是想双击记录才打开文件,可是按照第一位的方法,鼠标点一下就打开文件了。
另外,我想点不同的记录打开不同的文件,比如点“1”就打开“1.doc”点“2”就打开“2.doc”.......,请将代码写详细点,小弟实在是个菜鸟。我会多多加分的。
Dim wordapp As New Word.Application
private sub command1_dblclick()
'double click the filename
wordapp.Visible = True
Call wordapp.Documents.Open("filename")
...
end sub
sub form_Unload()
'if quit
'do the things
'this will quit
Set wordapp = Nothing
end sub