How VB.NET Windows Application to open an Word Template(*.dot)
Shell("C:\123.dot") '失敗,變成文件1 Fail ,Docutment1
System.Diagnostics.Process.Start("C:\123.dot") '失敗,變成文件1 Fail ,Docutment1
'成功開啟123.dot
'Success open as 123.dot
'Way1
Dim myProcess As New Process
Try
myProcess.StartInfo.FileName = "C:\123.dot"
myProcess.StartInfo.Verb = "Open"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Way 2
Dim wdApp As Object ' Declare variable to hold the reference.
Try
wdApp = CreateObject("WORD.Application")
wdApp.Visible = True
wdApp.Application.WindowState = wdWindowStateMaximize
wdApp.DOCUMENTS.Open("C:\123.dot")
wdApp = Nothing
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
2011年1月14日 星期五
訂閱:
張貼留言 (Atom)





沒有留言:
張貼留言