473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Word does not show up when trying to open doc thro C#

VP
Hi,

I am trying to open an existing word document, the execution happens
with no error but Word does not come up and my document does not open.

This is the code I am using..

Microsoft.Office.Interop.Word.ApplicationClass WordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();

object missingValue = System.Reflection.Missing.Value;
object fileName = "C:\\test.doc" ;
object isVisible = true;

WordApp.Visible = true;

Microsoft.Office.Interop.Word.Document aDoc =
WordApp.Documents.Open(ref fileName, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref isVisible, ref missingValue, ref missingValue,
ref missingValue, ref missingValue);

WordApp.Visible = true;
aDoc.Activate();

Can anyone help me with this ?

thanks
V
Nov 16 '05 #1
2 6813
Copied the code into a button click event on a c# windows application and it
worked perfectly after adding a reference to the word interop.

"VP" wrote:
Hi,

I am trying to open an existing word document, the execution happens
with no error but Word does not come up and my document does not open.

This is the code I am using..

Microsoft.Office.Interop.Word.ApplicationClass WordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();

object missingValue = System.Reflection.Missing.Value;
object fileName = "C:\\test.doc" ;
object isVisible = true;

WordApp.Visible = true;

Microsoft.Office.Interop.Word.Document aDoc =
WordApp.Documents.Open(ref fileName, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref isVisible, ref missingValue, ref missingValue,
ref missingValue, ref missingValue);

WordApp.Visible = true;
aDoc.Activate();

Can anyone help me with this ?

thanks
V

Nov 16 '05 #2
VP
Hi,

Thats really weird. It still doesnt work for me, and I am doing
exactly that, on a button click event on my C# application. The funny
part is that the document shows that it is open when I check the
windows explorer -- but Word doesnt open up and I dont see my
document.
What could possibly be wrong?

Thanks
V
tony lock <to******@discussions.microsoft.com> wrote in message news:<4A**********************************@microso ft.com>...
Copied the code into a button click event on a c# windows application and it
worked perfectly after adding a reference to the word interop.

"VP" wrote:
Hi,

I am trying to open an existing word document, the execution happens
with no error but Word does not come up and my document does not open.

This is the code I am using..

Microsoft.Office.Interop.Word.ApplicationClass WordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();

object missingValue = System.Reflection.Missing.Value;
object fileName = "C:\\test.doc" ;
object isVisible = true;

WordApp.Visible = true;

Microsoft.Office.Interop.Word.Document aDoc =
WordApp.Documents.Open(ref fileName, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref isVisible, ref missingValue, ref missingValue,
ref missingValue, ref missingValue);

WordApp.Visible = true;
aDoc.Activate();

Can anyone help me with this ?

thanks
V

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Microsoft | last post by:
I'm trying to display a word document inside a web page, but everytime I do I get this error: Error Type: Microsoft VBScript runtime (0x800A0046) Permission denied: 'CreateObject' Does...
0
by: Bruce Zigenfous | last post by:
Hello, Here is the code. followed by an explanation for what I am trying to do. In particular, this line: BinaryStream.Write byteArray 'Need to format <%Response.Buffer=0 %> <!--#include...
6
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would...
0
by: Julia Baresch | last post by:
Everyone, I posted the message below back in February and didn't get any information. I also wasn't able to find any documentation in MS Help, web site, or other groups. I'm posting now with...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
1
by: AP | last post by:
Hi, I'm trying to use c# to pop up a dialog box when a user attempts to close word to prompt them if they want to exit or cancel (obviously other stuff needs to happen based on their selection...
3
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.