You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
929 B

Imports Microsoft.Office.Interop.Word
Public Class Form1
Dim objword As Microsoft.Office.Interop.Word.Application
Dim docword As Microsoft.Office.Interop.Word.Document
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
Try
startword()
objword.Documents.Open(OpenFileDialog1.FileName)
docword = objword.ActiveDocument
Catch ex As Exception
End Try
End If
End Sub
Sub startword()
Try
objword = CreateObject("Word.application")
objword.Application.Options.SaveInterval = 0
Catch ex As Exception
MsgBox(ex.Message)
Finally
objword.Visible = True
End Try
Try
Catch
End Try
End Sub
End Class