word reference

  • Thread starter Thread starter selen
  • Start date Start date
S

selen

Hello
I add Microsoft Word 10.0 Object Library from reference com.
and I am writing my code to create an instance of a Word application.My code
is
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
But my application give me error :
The type or namespace name 'ApplicationClass' does not exist in the class or
namespace 'kalite.Word' (are you missing an assembly reference?)

Where I am wrong.

Thanks..
 
Selen,

Are you sure that you have set a reference in the project you are using?
Either that, or are you sure that the line is:

Word.ApplicationClass oWordApp = new Word.ApplicationClass();

And not:

ApplicationClass oWordApp = new ApplicationClass();
 
Yes I am sure. I wrote using Word;
and I write below code but this give me error that missing The name
'missing' does not exist in the class or namespace 'kalite.Word'

ApplicationClass oWordApp = new ApplicationClass();

Document oWordDoc = oWordApp.Documents.Add(ref missing,

ref missing,ref missing, ref missing);

oWordDoc.Activate();

oWordApp.Selection.TypeText("This is the text");

oWordApp.Selection.TypeParagraph();

oWordDoc.SaveAs("c:\\myfile.doc");

oWordApp.Application.Quit(ref missing, ref missing, ref missing);



iletide said:
Selen,

Are you sure that you have set a reference in the project you are using?
Either that, or are you sure that the line is:

Word.ApplicationClass oWordApp = new Word.ApplicationClass();

And not:

ApplicationClass oWordApp = new ApplicationClass();


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

selen said:
Hello
I add Microsoft Word 10.0 Object Library from reference com.
and I am writing my code to create an instance of a Word application.My code
is
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
But my application give me error :
The type or namespace name 'ApplicationClass' does not exist in the
class
or
namespace 'kalite.Word' (are you missing an assembly reference?)

Where I am wrong.

Thanks..
 
selen said:
Yes I am sure. I wrote using Word;
and I write below code but this give me error that missing The name
'missing' does not exist in the class or namespace 'kalite.Word'

ApplicationClass oWordApp = new ApplicationClass();

Document oWordDoc = oWordApp.Documents.Add(ref missing,
ref missing,ref missing, ref missing);
oWordDoc.Activate();
oWordApp.Selection.TypeText("This is the text");
oWordApp.Selection.TypeParagraph();
oWordDoc.SaveAs("c:\\myfile.doc");
oWordApp.Application.Quit(ref missing, ref missing, ref missing);

Well you certainly haven't given any indication of where the missing
variable *is* declared...
 
Back
Top