PDA

View Full Version : VBA code as a Reference Field Code



Flatlander
07-02-2013, 03:25 AM
Hi,

I have been looking around the web for a solution, but came up with nothing. So I thought I throw it in the group here.

I need to create a running header based on the level 3 heading (chapter-section. In my case this is level 3, as I have parts as 1, chapter as 2, etc).

The problem is that if there is no level 3, it should not take the one from the previous chapter, but instead use the chapter name (level 2).

I can write this in VBA, but this is not updated automatically if I add/edit sections.

Is there a special REF field that basically returns the result of some VBA code? That would be ideal, otherwise any hints how to deal with this?

Edit: I forgot to mention: Every chapter-section (level 3) is a new word-section, because sometimes I need to edit the automatic header (i.e. when it is too long to fit nicely in the header).

Thanks,
Martijn