i need to open a word document from a button click event. I have tried several things suggested in these forums and none seem to be working.
I need to be able to open the document "BCCheckSettings2003.doc" from a subdirectory of my documents called "Bookmarks Galore!" .
Since each user will have a different path to my documents I am thinking I need to get that path first. Here is the code I am using (Thank you RobDogg88, I found the code in your word FAQ's)
it is breaking at the oprocess.start() and telling me it can't find the file.Code:Private Sub btnWord03_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord03.Click Dim oProcess As New System.Diagnostics.Process Dim mydocs As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) 'Dim strFileName As String MsgBox(mydocs) mydocs = mydocs & "\" & "Bookmarks Galore" & "\" MsgBox(mydocs) 'strFileName = mydocs & "BCCheckSettings2003.doc" 'MsgBox(strFileName) With oProcess.StartInfo .CreateNoWindow = True .WindowStyle = ProcessWindowStyle.Hidden .Verb = "open" .UseShellExecute = True .FileName = mydocs & "BCCheckSettings2003.doc" End With oProcess.Start() End Sub
Please help! Proejct is overdue.


Reply With Quote