[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

How do I grab a document which is already open from inside .NET

Asked by capsoftuk in Microsoft Development, C# Programming Language, Microsoft Word

Hi there,

I've posted a few questions today, and I'm nearly there with what I'm trying to acheive. Much appreciation for the help recieved already.

My next query is regarding the way that .NET takes control of the documents. Basically, my program launches when the user clicks a button on a Word toolbar. The filename of the document is passed through to the program, and the c# program is then supposed to take input from a textbox and then insert that at the cursor's position in the Word Document.

Problem seems to be that I am trying to open the document again to allow the Word object to work. However, in this scenario, when I try to insert the text into the original document, it tells me 'The file is locked for editing by such and such - try one of these options' which then asks if I want to merge the changes, which I don't. I want it to just insert the new text and have no issues with who has permission on the file at that moment.

It seems to me that I either need my .NET program to imitate the user who has control over the document, or that my .NET program has to 'grab' the handle of the MS document and use that to populate the Word object. Can someone shed some light on this situation please? Much obliged. Oh, and please don't send me links for the hell of it - you're not getting any points if you put a link without expanding a bit on what the deal is.

Cheers

Andy
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
// TWO that haven't worked 
//msWordDoc = msWordApp.Documents.Open(ref RTFfilepath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
                
//msWordDoc = msWordApp.Documents.get_Item(ref missing); 
string filename = Path.GetFileName((string)RTFfilepath);              
//doesn't work, but I'm looking for something like this - so that the program grabs the 'handle' of the document if you like but doesn't have to open it. Do I have to look into imitating permissions??
msWordDoc = msWordApp.Documents(filename) 

msWordApp.Content.InsertAfter(theText);
[+][-]11/06/09 10:25 AM, ID: 25761643Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Microsoft Development, C# Programming Language, Microsoft Word
Sign Up Now!
Solution Provided By: kaufmed
Participating Experts: 1
Solution Grade: A
 
[+][-]11/04/09 09:47 AM, ID: 25741879Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 09:49 AM, ID: 25741898Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 02:03 AM, ID: 25747986Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 07:29 AM, ID: 25750475Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 07:37 AM, ID: 25750597Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 03:24 PM, ID: 25755231Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 01:35 AM, ID: 25757780Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625