index > Visual Studio Tools for Office > VB.NET: Problem with Page header in Word Document

VB.NET: Problem with Page header in Word Document


Hi,

Balambikai N P

Hi Bala

Technically, this question belongs in the office.developer.automation newsgroup, or even better, in a Word-oriented programming group, such as word.vba.general (see the "Please Read First" posting at the top of this forum). There, you'd get the some of the best minds for the Word object model thinking about possible approaches. Here's my take on it:

The problem is that, as I understand it, your code runs once? What you want, I should think, is something more dynamic. I' m wondering if it wouldn't be better to nest the StyleRef in an IF field (or use a set of nested IF fields). Check whether the result is an empty string; if so, try the next level, and so on, until you get the result you need. Very roughly:

{ IF "{ StyleRef 1 }" = "" "{ Style Ref 2 }" "{ StyleRef 1}" }

Building a set of nested fields programmatically isn't terribly straight-forward, however. There is an article at word.mvps.org (http://word.mvps.org/faqs/macrosvba/NestedFieldsWithVBA.htm), but I don't agree with the approaches it presents. Nested field CAN be created using the Range object, it just takes a little more work. One approach is described here http://gregmaxey.mvps.org/Field_Macros.htm (end of the page).




-- Cindy Meister (Word MVP)
Cindy Meister
reply 2

You can use google to search for other answers

 

More Articles

If I download Visualt Studio 2005 standard and later can I upgrad...
MDX query to filter the cube
VSTO deployment ??light solution.
Office 2007 Editions and Cypress
any way to print excel directly with one button click
C#, Word VSTO and OnAction (oh my)
Outlook: Make mail properties readonly
Word Interop Hangs When Deployed To Server - Help!
How to disable database schema validation in Visio 2003
How do i Hide fields so that they don't take up space on my form?
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

I want to get contacts lists(email&t…
Can the server document do the following…
Performance issue
Addin for Outlook2000
VSTO 2005 Beta2 FAQ
How can I standardize SIGNATURES in OUTL…
Security Deployment Package
Adding attachment to a mail
Easy one
VSTO2005 Beta2 : Caching Data with Serve…
Developing excel VSTO solution on network?
Outlook accounts
Hands-on-Lab 04
Add VSTORuntime and PIA to the bootstrap…
Standard not suppoted!!!!!

Hot Articles

Cannot attach VSTO Customization via Cus…
A plea for a second forum
Document protection
Does the client needs .net framework 2?
Proxies for Java Class
Merge Field Collection devoid of merge f…
XMLNode instances in Word Document
What is the best way to change an Excel …
show excel chart on a form in excel 2000.
Excel to xml conversion -Decimal point p…
List WordML (ilfo and ilvl) getting lost…
How to use the Events of Outlook.Applica…
VSTO Deployment
tabbing thru a form in word doc, need to…
Office 2003 and Office XP.

Recommend Articles

want to use Shapes::AddLine funtion t…
VSTO 2005, .NET 2.0 Custom Smart Tags
Could not load file or assembly 'Microso…
VSTO in msdn
unload Smart Document on initialize
Is there any way to have the setup.exe b…
Excel Template And Sharepoint
Office Word 2003 component in .Net 2005
Prolbems using webservices in the addin …
Does VSTO offer similar functionality to…
ReadingPane - button
Can I create SharePoint Webparts with RTM?
Collapsible Actions Pane sections
help needed regarding adding a contact i…
VSTO for Excel Deployment kit