Group:  Microsoft Word ยป microsoft.public.word.vba.customization
Thread: [Word 2007] Disable or repurpose X close button

Geek News

[Word 2007] Disable or repurpose X close button
mister.tree[ at ]gmail.com 5/9/2007 9:06:27 AM
Hi,

I need to know if there is a way to disable the X close button because
the add-in I am developing for Word 2007 is having errors if we quit
the word application using the X close button.
I've been able to able to repurpose the FileExit in the Office Menu by
writing a vba macro which is

"Sub FileExit(control As IRibbonControl, ByRef cancelDefault)"

and in the XML file: <command
idMso="FileExit"
onAction="FileExit"/>

I tried to repurpose the X close button by adding this in the XMl
file:
<command
idMso="WindowClose"
onAction="FileExit"/>

but it seems to be out of reach this way.

I thought about using only VBA to reach the X close button but didnt
have find yet.

More over, i'd like to disable specific options in the word Options
dialog but it's not possible using custom Ui XML so I thought about
using VBA also with Application.options as it was possible in word
2003 but need to know the new properties and object model.

I have been searching on microsoft websites, newsgroups, P.Schmidt (Hi
^^) forums and what else... well a lot of others websites.

If someone could answer this it would be great

kind regards, ^____^

Re: [Word 2007] Disable or repurpose X close button
"Perry" <drumper[ at ]gmail.com> 5/9/2007 6:46:10 PM
Eventhough disabling/repurposing the X button (Application Close)
functionallity through VBA is possible using API calls.
However, without critisizing your app but I would invest in analysing what
the problems are.

Do you have a process going on in your application, needing Word to be
active?
If so, can't you make the target Word instance invisible rather then
disabling the X button?
What are the problems your running into ?

Btw, another implication of disabling the X button, this will also interfere
with users trying to quit the current Word instance using the UI File menu
option in pre Word 2007 versions and users trying to quit MS Word using the
Office button in Word 2007.

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE



<mister.tree[ at ]gmail.com> schreef in bericht
news:1178701587.466972.143750[ at ]o5g2000hsb.googlegroups.com...
[Quoted Text]
> Hi,
>
> I need to know if there is a way to disable the X close button because
> the add-in I am developing for Word 2007 is having errors if we quit
> the word application using the X close button.
> I've been able to able to repurpose the FileExit in the Office Menu by
> writing a vba macro which is
>
> "Sub FileExit(control As IRibbonControl, ByRef cancelDefault)"
>
> and in the XML file: <command
> idMso="FileExit"
> onAction="FileExit"/>
>
> I tried to repurpose the X close button by adding this in the XMl
> file:
> <command
> idMso="WindowClose"
> onAction="FileExit"/>
>
> but it seems to be out of reach this way.
>
> I thought about using only VBA to reach the X close button but didnt
> have find yet.
>
> More over, i'd like to disable specific options in the word Options
> dialog but it's not possible using custom Ui XML so I thought about
> using VBA also with Application.options as it was possible in word
> 2003 but need to know the new properties and object model.
>
> I have been searching on microsoft websites, newsgroups, P.Schmidt (Hi
> ^^) forums and what else... well a lot of others websites.
>
> If someone could answer this it would be great
>
> kind regards, ^____^
>

Re: Disable or repurpose X close button
mister.tree[ at ]gmail.com 5/15/2007 9:44:04 AM
Old version of my app was launching word 2003,2000,97 in order to
perform specific tasks from the app. Minimize,restore and close
buttons (top-right corner of the window) were disabled(not visible in
fact) using API calls. And close ,quit ,open etc in Word file menu
were repurposed with own vba macros.
The fact is when we started to look if our old xxx.dot file(containing
all vba macros) was running on the new Word 2007, we noticed all vba
macros were compatible but only minize button was disabled (in fact
not visible as in old version) but not others buttons restore and
close.

So the app launches Word and loads a template file (.dot) and now a
new template (which customise the ribbon UI, .dotm), both are loaded
if a version of Word 2007 is detected. The app allows users to write
specific mails using our macros in a customised Word then we need Word
to be visible. I don't really care about restore button, more with the
X close button. I've been able to repurpose the File Exit button in
the Office menu (word 2007) with a macro which quits Word and makes
others things, I'd like to force users to quit Word using this button.
For example, if you quit word launched by my app with the x close
button , there will be a msgbox from the app asking if you want to
save your document(we save documents in a database) and after the word
2007 msgbox asking you if you want to save your document (local) and
we don't want that, but there are others problems due to this X close
button.
We want to make this button not visible. It seems on Word 2007 you
can't disable X close button(make it not visible) using API calls the
same way as in old versions of Word. We had prefer to repurpose it but
it seems to be out of reach so we want to disable it, it would be
easier instead of investigate all errors that could occur if you quit
word using X close button.

sorry about my poor english, I hope you can understand what I tried to
explain :-D

kind regards,

_______________
Arnaud H.

Re: Disable or repurpose X close button
mister.tree[ at ]gmail.com 5/15/2007 9:49:35 AM
Old version of my app was launching word 2003,2000,97 in order to
perform specific tasks from the app. Minimize,restore and close
buttons (top-right corner of the window) were disabled(not visible in
fact) using API calls. And close ,quit ,open etc in Word file menu
were repurposed with own vba macros.
The fact is when we started to look if our old xxx.dot
file(containing
all vba macros) was running on the new Word 2007, we noticed all vba
macros were compatible but only minize button was disabled (in fact
not visible as in old version) but not others buttons restore and
close.

So the app launches Word and loads a template file (.dot) and now a
new template (which customise the ribbon UI, .dotm), both are loaded
if a version of Word 2007 is detected. The app allows users to write
specific mails using our macros in a customised Word then we need
Word
to be visible. I don't really care about restore button, more with
the
X close button. I've been able to repurpose the File Exit button in
the Office menu (word 2007) with a macro which quits Word and makes
others things, I'd like to force users to quit Word using this
button.
For example, if you quit word launched by my app with the x close
button , there will be a msgbox from the app asking if you want to
save your document(we save documents in a database) and after the
word
2007 msgbox asking you if you want to save your document (local) and
we don't want that, but there are others problems due to this X close
button.
We want to make this button not visible. It seems on Word 2007 you
can't disable X close button(make it not visible) using API calls the
same way as in old versions of Word. We would prefer to repurpose it
but
it seems to be out of reach so we want to disable it, it would be
easier instead of investigate all errors that could occur if you quit
word using X close button.


sorry about my poor english, I hope you can understand what I tried
to
explain :-D


kind regards,


_______________
Arnaud H.

Re: Disable or repurpose X close button
mister.tree[ at ]gmail.com 5/15/2007 9:54:01 AM
Old version of my app was launching word 2003,2000,97 in order to
perform specific tasks from the app. Minimize,restore and close
buttons (top-right corner of the window) were disabled(not visible in
fact) using API calls. And close ,quit ,open etc in Word file menu
were repurposed with own vba macros.

The fact is when we started to look if our old xxx.dot
file(containing
all vba macros) was running on the new Word 2007, we noticed all vba
macros were compatible but only minize button was disabled (in fact
not visible as in old version) but not others buttons restore and
close.

So the app launches Word and loads a template file (.dot) and now a
new template (which customise the ribbon UI, .dotm), both are loaded
if a version of Word 2007 is detected. The app allows users to write
specific mails using our macros in a customised Word then we need
Word to be visible. I don't really care about restore button, more
with the
X close button. I've been able to repurpose the File Exit button in
the Office menu (word 2007) with a macro which quits Word and makes
others things, I'd like to force users to quit Word using this
button.
For example, if you quit word launched by my app with the x close
button , there will be a msgbox from the app asking if you want to
save your document(we save documents in a database) and after
the word 2007 msgbox asking you if you want to save your
document (local) and we don't want that, but there are others
problems due to this X close button.

We want to make this button not visible. It seems on Word 2007 you
can't disable X close button(make it not visible) using API calls the
same way as in old versions of Word. We would prefer to
repurpose it but it seems to be out of reach so we want to disable it,
it would be easier instead of investigate all errors that could
occur
if you quit word using X close button.


sorry about my poor english, I hope you can understand what I tried
to
explain :-D


kind regards,


_______________
Arnaud H.

Re: Disable or repurpose X close button
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 5/15/2007 11:13:21 AM
Maybe you will find some ideas at:

http://vbnet.mvps.org/index.html?code/forms/killclose.htm

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

<mister.tree[ at ]gmail.com> wrote in message
news:1179222840.723612.57500[ at ]e51g2000hsg.googlegroups.com...
[Quoted Text]
> Old version of my app was launching word 2003,2000,97 in order to
> perform specific tasks from the app. Minimize,restore and close
> buttons (top-right corner of the window) were disabled(not visible in
> fact) using API calls. And close ,quit ,open etc in Word file menu
> were repurposed with own vba macros.
>
> The fact is when we started to look if our old xxx.dot
> file(containing
> all vba macros) was running on the new Word 2007, we noticed all vba
> macros were compatible but only minize button was disabled (in fact
> not visible as in old version) but not others buttons restore and
> close.
>
> So the app launches Word and loads a template file (.dot) and now a
> new template (which customise the ribbon UI, .dotm), both are loaded
> if a version of Word 2007 is detected. The app allows users to write
> specific mails using our macros in a customised Word then we need
> Word to be visible. I don't really care about restore button, more
> with the
> X close button. I've been able to repurpose the File Exit button in
> the Office menu (word 2007) with a macro which quits Word and makes
> others things, I'd like to force users to quit Word using this
> button.
> For example, if you quit word launched by my app with the x close
> button , there will be a msgbox from the app asking if you want to
> save your document(we save documents in a database) and after
> the word 2007 msgbox asking you if you want to save your
> document (local) and we don't want that, but there are others
> problems due to this X close button.
>
> We want to make this button not visible. It seems on Word 2007 you
> can't disable X close button(make it not visible) using API calls the
> same way as in old versions of Word. We would prefer to
> repurpose it but it seems to be out of reach so we want to disable it,
> it would be easier instead of investigate all errors that could
> occur
> if you quit word using X close button.
>
>
> sorry about my poor english, I hope you can understand what I tried
> to
> explain :-D
>
>
> kind regards,
>
>
> _______________
> Arnaud H.
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net