Question:
Opening MS Word in VB.net application.?
2007-05-07 06:42:38 UTC
In my VB.net application, i want MS word to open when a button is clicked. Many tutorials said it can be done by "Imports Microsoft.Office.Interop" statement. But it gives an error.
Can somebody tell me how to do this.
(Both .NET framework and MS Office XP PIAs are installed)
Thanks in advance.
Three answers:
2007-05-07 06:57:03 UTC
http://msdn2.microsoft.com/en-us/library/bb407305(VS.80).aspx



Says it's for Word 2007 but the principal is exactly the same for Word 2000 +; Create an Application object and manipulate that.
christianprogrammer2
2007-05-07 06:54:43 UTC
Have your program run external program Microsoft word, when the click on button event occurs. Use the shell command.
math guy
2007-05-07 07:16:20 UTC
this works in vb6, should work in .net



Set shell = CreateObject("WScript.Shell")

shell.Run """C:\Program Files\Microsoft Office\Office10\WINWORD.exe"" file.doc"



if you dont like that method this is just as effective



Shell "winword.exe", vbNormalFocus


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...