DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 28 Jun 2007 11:39:35 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    unknown
          2    unknown


New Wprd.Application failing with "This command is not available because no document is open"   
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 =
Date:Thu, 28 Jun 2007 11:39:35 -0700   Author:  

Re: New Wprd.Application failing with "This command is not available because no document is open"   
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
> 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 =
Date:Fri, 29 Jun 2007 09:44:51 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us