Outlook Script: How to hide Command Menu ?

B

bbnimda

Hi All,

On my personal Form, I want to hide all command menu if possible, or , at
least Save command menu

I Added a save button on my form (it perform a test which check if there is
another Contact with same Name & N°)

whith my save button I'll refuse to save a contact that already exist

Tks
 
S

Sue Mosher [MVP-Outlook]

You'd need to access each control in the Application.ActiveMenuBar.Controls collection and set its Visible property to False ... then reverse the process when the item closes.

BUT ... whatever change you make will also affect other open items, so this may not be a good approach. A better one would be to put code in the Item_Write event handler to check whether the item already exists and then cancel that event by setting the function's return value to False. That way, it doesn't matter how the user saves the item.
 
B

bbnimda

Hi Sue,

U're right it's better to use Item_write() function but,

How Do I remain in the Form after displaying my Error message , right now
each time my Form is closed

I need to remain in the form until the user change the Name or The N° or
cancel the file

thks

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
You'd need to access each control in the Application.ActiveMenuBar.Controls
collection and set its Visible property to False ... then reverse the
process when the item closes.

BUT ... whatever change you make will also affect other open items, so this
may not be a good approach. A better one would be to put code in the
Item_Write event handler to check whether the item already exists and then
cancel that event by setting the function's return value to False. That way,
it doesn't matter how the user saves the item.
 
S

Sue Mosher [MVP-Outlook]

Repeating: cancel that event by setting the function's return value to False:

Function Item_Write()
If <condition is not met> Then
Item_Write = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

U're right it's better to use Item_write() function but,

How Do I remain in the Form after displaying my Error message , right now
each time my Form is closed

I need to remain in the form until the user change the Name or The N° or
cancel the file

thks

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
You'd need to access each control in the Application.ActiveMenuBar.Controls
collection and set its Visible property to False ... then reverse the
process when the item closes.

BUT ... whatever change you make will also affect other open items, so this
may not be a good approach. A better one would be to put code in the
Item_Write event handler to check whether the item already exists and then
cancel that event by setting the function's return value to False. That way,
it doesn't matter how the user saves the item.
 
B

bbnimda

Hi Sue,

I've a Pb with Item_Write,

Before Saving my contact file I chek if an existing contact haven't the same
N° and the Same Name,
it work fine for new contact item, but when I modify some information on an
existing item (location, mail , address etc...)
My warnig message tell me that this contact exist and I can't save my
modification


It tryed to check creation time, and allow Write if it's not à New contact
but in this case people can change the name and
save the contat item even if the contact exist


do know a solution to my Pb


thks



"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de %[email protected]...
Repeating: cancel that event by setting the function's return value to
False:

Function Item_Write()
If <condition is not met> Then
Item_Write = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

U're right it's better to use Item_write() function but,

How Do I remain in the Form after displaying my Error message , right now
each time my Form is closed

I need to remain in the form until the user change the Name or The N° or
cancel the file

thks

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de news: (e-mail address removed)...
You'd need to access each control in the
Application.ActiveMenuBar.Controls
collection and set its Visible property to False ... then reverse the
process when the item closes.

BUT ... whatever change you make will also affect other open items, so
this
may not be a good approach. A better one would be to put code in the
Item_Write event handler to check whether the item already exists and then
cancel that event by setting the function's return value to False. That
way,
it doesn't matter how the user saves the item.
 
B

bbnimda

I found it

I have just to compare the entry ID

what do you think ??



bbnimda said:
Hi Sue,

I've a Pb with Item_Write,

Before Saving my contact file I chek if an existing contact haven't the
same N° and the Same Name,
it work fine for new contact item, but when I modify some information on
an existing item (location, mail , address etc...)
My warnig message tell me that this contact exist and I can't save my
modification


It tryed to check creation time, and allow Write if it's not à New contact
but in this case people can change the name and
save the contat item even if the contact exist


do know a solution to my Pb


thks



"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message de %[email protected]...
Repeating: cancel that event by setting the function's return value to
False:

Function Item_Write()
If <condition is not met> Then
Item_Write = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

U're right it's better to use Item_write() function but,

How Do I remain in the Form after displaying my Error message , right now
each time my Form is closed

I need to remain in the form until the user change the Name or The N° or
cancel the file

thks

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de news: (e-mail address removed)...
You'd need to access each control in the
Application.ActiveMenuBar.Controls
collection and set its Visible property to False ... then reverse the
process when the item closes.

BUT ... whatever change you make will also affect other open items, so
this
may not be a good approach. A better one would be to put code in the
Item_Write event handler to check whether the item already exists and
then
cancel that event by setting the function's return value to False. That
way,
it doesn't matter how the user saves the item.
 
S

Sue Mosher [MVP-Outlook]

That should work. If the EntryID of the matching contact is the same as the existing contact, it's OK to save it.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
I found it

I have just to compare the entry ID

what do you think ??



bbnimda said:
Hi Sue,

I've a Pb with Item_Write,

Before Saving my contact file I chek if an existing contact haven't the
same N° and the Same Name,
it work fine for new contact item, but when I modify some information on
an existing item (location, mail , address etc...)
My warnig message tell me that this contact exist and I can't save my
modification


It tryed to check creation time, and allow Write if it's not à New contact
but in this case people can change the name and
save the contat item even if the contact exist


do know a solution to my Pb


thks



"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message de %[email protected]...
Repeating: cancel that event by setting the function's return value to
False:

Function Item_Write()
If <condition is not met> Then
Item_Write = False
End If
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

U're right it's better to use Item_write() function but,

How Do I remain in the Form after displaying my Error message , right now
each time my Form is closed

I need to remain in the form until the user change the Name or The N° or
cancel the file

thks

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de news: (e-mail address removed)...
You'd need to access each control in the
Application.ActiveMenuBar.Controls
collection and set its Visible property to False ... then reverse the
process when the item closes.

BUT ... whatever change you make will also affect other open items, so
this
may not be a good approach. A better one would be to put code in the
Item_Write event handler to check whether the item already exists and
then
cancel that event by setting the function's return value to False. That
way,
it doesn't matter how the user saves the item.
Hi All,

On my personal Form, I want to hide all command menu if possible, or ,
at
least Save command menu

I Added a save button on my form (it perform a test which check if there
is
another Contact with same Name & N°)

whith my save button I'll refuse to save a contact that already exist
 

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