How to disable the "Alter footnote number" dialog boks

C

CJ

In my document-level addin I have the document displayed including xml markup
elements. Upon trying to alter a footnote or endnote number in my document
I'm met with a dialog box with three buttons: Delete, Options and Cancel. Is
there any way of disabling this dialog box?

To reproduce my scenario in Word 2003 you need to

1. open an empty document
2. write a line of text
3. insert a footnote somewhere (will be inserted as number 1 (one))
4. highlight/select the footnote number (and only this) in the document
5. press 2 to try to renumber the footnote


It's the dialog displayed here I would like to disable...
 
S

Stefan Blom

As far as I know, there is no way to disable the message you are referring
to (but I could be wrong).

The warning message is actually useful as it prevents (inexperienced) users
from inadvertently deleting the footnote text.

I guess the question is, What do you want to happen when typing over a
footnote?
 
L

Lene Fredborg

I am not sure in which way the footnote number is going to be changed either.
However, it seems as if setting DisplayAlerts = wdAlertsNone will prevent the
dialog box from appearing. I just tested as follows: I selected a footnote
reference number and executed the following code – the number was replaced by
a plain “2†and the dialog box did not appear:

Application.DisplayAlerts = wdAlertsNone
Selection.TypeText "2"
Application.DisplayAlerts = wdAlertsAll

So maybe this method can be used.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
C

CJ

Lene Fredborg said:
However, it seems as if setting DisplayAlerts = wdAlertsNone will prevent the dialog box from appearing.

Hi Lene

I just tried the following line in my SetupWordApplication() method:

Application.DisplayAlerts = WdAlertLevel.wdAlertsNone;

Unfortunately no dice :-( The alert is still displayed... I double checked
that the line was actually called so any clues as to what might be causing
this?

Thanks
 
L

Lene Fredborg

Before posting yesterday, I first tried changing the number manually
following the steps you described – and the alert appeared. I then made the
code, tested – and the alert did not appear. I now tried manipulating the
number via VBA without first setting alerts to wdAlertsNone – and the alert
did not appear… (should have tested this in the first place).

So it seems that things work differently here. Unfortunately, I cannot tell
why (tested in both Word 2003 and 2007).

A comment about where to place the code: You say you inserted the code in
your “SetupWordApplication() methodâ€. I don’t know how your code is
constructed. Is that another place than the procedure or function where you
have the code to manipulate the number? I think it is always best to only
turn off the display of alerts exactly in the place where an alert causes
problems – and remember to include the Application.DisplayAlerts =
wdAlertsAll line afterwards in order to revert to normal mode. Otherwise, you
risk preventing important alerts from appearing in other situations.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
C

CJ

Lene Fredborg said:
A comment about where to place the code: You say you inserted the code in your “SetupWordApplication() methodâ€.

Sorry - should have been more clear on that. My SetupWordApplication() is
called from the ThisDocument_Startup event and handles all sorts of option
tweaks upon start of my editor. Similarly we have a ResetWordApplication()
method in our ThisDocument_CloseEvent event.

Hmm... I will explore your suggestion a little bit more to see if I can come
up with something. But moving the wdAlertsNone closer to where I need it
would mean to move it into my DocumentSelectionChanged event which I really
would prefer not do do.

Thanks for your effort...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top