I have developed an addin in C# .Net 2003 and using framework 1.1. After installing this custom addin I am facing a problem while inserting the path of the file in a word document.

Steps to reproduce the issue.

1. Put your cursor at the point in the document where you'd like the path and filename to appear (header or footer, etc.)
2. Click the Insert menu
3. Choose Field...
4. Select Document Information from the Categories list
5. Select FileName from the Field Names list
6. Click the Options button
7. Select the Field Specific Switches tab
8. Select the option for \p
9. Click the Add to Field button
10. Click OK
11. Click OK
After inserting path it is not highlighted in grey color. Moreover this problem is not coming on every desktop. Only couple of desktops are facing the problem. Can anybody help me with this problem.

Thanks in advance.

Re: Visual Studio Tools for Office Word Addin - file path is not getting highlighted.


Move thread to VSTO from VB IDE

Re: Visual Studio Tools for Office Word Addin - file path is not getting highlighted.

Cindy Meister

Hi Jahid

This forum is specifically for questions concerning the VSTO technology. For future questions about Shared Add-ins and any Office applications you may be working with, see the list of newsgroup links here.

The steps you outline above insert a FIELD in the Word document. (Fields provide dynamic information in Word documents). The gray you're looking for is referred to as "field shading". Whether and when this appears depends on a setting in Tools/Options/View; it can be set to "Never", "When selected" and "Always". This setting applies across the entire application (all open documents).

The installation default is, I believe, "When selected". If that's not the case on a few desktops, it means the user has probably changed the setting. Strictly speaking, it would be "rude" of you Add-in to alter the user's setting (in the object model it's a property of Application.Options). So consider a message that explains to the user why you want to change this setting and let him decide.