Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2007

Tip: Looking for answers? Try searching our database.

New Wprd.Application failing with "This command is not available because no document is open"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mdupris@hotmail.com - 28 Jun 2007 19:39 GMT
I can't open a Word session in a C# session without getting an error
"This command is not available because no document is open". The
simplest code illustrating the problem is below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;

namespace JustOpenWord
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }

       private void button1_Click(object sender, EventArgs e)
       {
           Word.Application oWord =  new Word.Application();
       }
   }
}

The error occurs on execution of the "Word.Application oWord =  new
Word.Application();" line.

The same failure occurs with variants such as "ApplicationClass" or
"_Application".  I've tried using "try/catch" to manage the error, and
the pop-up, without success. Suspecting an Office configuration issue
(Office 2003 running in Windows XP) I re-installed Office, without
success.

Anyone have any clues what's going on here? They would be greatly
appreciated.

= M =
mdupris@hotmail.com - 29 Jun 2007 17:44 GMT
Never mind... Seems an old COM Add-in had inserted itself into the
system and was fouling things up. (Loud "Duh!" sound at this end, when
it was discovered).

= M =

On Jun 28, 11:39 am, mdup...@hotmail.com wrote:
> I can't open a Word session in a C# session without getting an error
> "This command is not available because no document is open". The
[quoted text clipped - 39 lines]
>
> = M =

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.