I try to follow this LINK but this tutorial is viewing direct an MS Word that has already an data to it.
I also try this code below
Dim objWord As Word.Application
Dim objDoc As Word.Document
objWord = CreateObject("Word.Application")
objDoc = objWord.Documents.Open("G:\Folder\NewFolder\HHHHH.docx")
objWord.Visible = True
but this code is fix that if the MS Word it in that path and view it.
All I want to achieve is Browse the MS Word wherever it is located on my PC and display it in the form. And if possible click a button and preview it in crystal report. So I can print it.
You can use OpenFileDialog:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim filedialog As New OpenFileDialog
filedialog.InitialDirectory = "C:\"
filedialog.Filter = "Word Files|*.docx"
filedialog.ShowDialog()
End Sub
works fine for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.