I am battling with this code.
I want to open a word document from a button and want the document (attendance register) to be available to resources once compiled and using on CD from another PC.
At present having issues getting it right!!!
Public Class Form2
Private WordApp As New Microsoft.Office.Interop.Word.Application
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
'Dim fileName As Object = OpenFileDialog1.FileName
Dim fileName As Object = "C:\Users\admin\Documents\Visual Studio 2005\Projects\Test1\Test1\bin\Debug\Resources\Attendance Register.doc"
'Dim readOnly as Object = False
Dim isVisible As Object = True
Dim missing As Object = System.Reflection.Missing.Value
WordApp.Visible = True
Dim aDoc As Microsoft.Office.Interop.Word.Document
aDoc = WordApp.Documents.Open(fileName, , False, False, , , True)
Me.Hide()
'End If
End Sub
I am using visual Studio 2005 proffesional, windows7, Office 2007 but saving doc's as 2003.
Please it's been 3 weeks that I am not getting it right, see if anyone can help