A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

vbscript to remove custom Outlook Toolbars



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 20th 08, 01:16 PM posted to microsoft.public.outlook.program_vba
movalgirl
external usenet poster
 
Posts: 11
Default vbscript to remove custom Outlook Toolbars

Hi all,

due to some faulty programming my C++ COMAddIn does not delete the
custom toolbar it has created.

I am attempting to write a vbscript which will allow the administrator
to cleanup this toolbar without having to install a macro/ComAddin or
anything of the sort.

Is this possible in vbscript? Can someone point me in the direction of
the OOM objects which are available in vbscript as opposed to VBA?


A small snippet of how I think the removal of the toolbar should work
is posted below.

--------------------------------------------------------------------------------

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Outlook", , FALSE, TRUE

Set myOlExp = objOutlook.ActiveExplorer
Set myCmdBars = myOlExp.CommandBars

mycbars.delete("My toolbar")

Wscript.Echo "done"
objOutlook.Quit
  #2  
Old March 20th 08, 01:42 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default vbscript to remove custom Outlook Toolbars

Something like that should work, although I'd change the NameSpace.Logon to
objNameSpace.Logon "", "", False, True or even use False for the NewSession
argument.

Of course the real solution is to create the toolbar using the Temporary =
true argument and to explicitly delete it in the Explorer.Close() event
handler.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"movalgirl" wrote in message
...
Hi all,

due to some faulty programming my C++ COMAddIn does not delete the
custom toolbar it has created.

I am attempting to write a vbscript which will allow the administrator
to cleanup this toolbar without having to install a macro/ComAddin or
anything of the sort.

Is this possible in vbscript? Can someone point me in the direction of
the OOM objects which are available in vbscript as opposed to VBA?


A small snippet of how I think the removal of the toolbar should work
is posted below.

--------------------------------------------------------------------------------

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Outlook", , FALSE, TRUE

Set myOlExp = objOutlook.ActiveExplorer
Set myCmdBars = myOlExp.CommandBars

mycbars.delete("My toolbar")

Wscript.Echo "done"
objOutlook.Quit


  #3  
Old March 25th 08, 12:56 PM posted to microsoft.public.outlook.program_vba
movalgirl
external usenet poster
 
Posts: 11
Default vbscript to remove custom Outlook Toolbars

Thanks for the tip. Unfortunately, it is legacy code which creates
this permanent toolbar - new versions
only create the toolbar as a "temporary" toolbar. I have to work out
some way to automatically delete this permanent toolbar
during an upgrade of our software.


I am now using the following vbscript to delete the permanent toolbar.
The toolbar is deleted in the
current outlook session but at the next Outlook startup - there it is
again. Worse than the plague :-)

-----------------------------------------------------------------
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "","", FALSE, TRUE


Set oCBars = objOutlook.ActiveExplorer.CommandBars
For i = oCBars.Count To 1 Step -1
Wscript.Echo oCBars.Item(i).Name
If oCBars.Item(i).Name = "IXOSOST" Then
oCBars.Item(i).Delete
End If
Next


Wscript.Echo "done"
objOutlook.Quit
------------------------------------------------------------------------
p.s. i cannot simply delete the extend.dat file as the customer has
numerous
other addIns and not much of a sense of humour...

Thanks in advance,
movalgirl


------------------------------------------------
On Mar 20, 2:16*pm, movalgirl wrote:
Hi all,

due to some faulty programming my C++ COMAddIn does not delete the
custom toolbar it has created.

I am attempting to write a vbscript which will allow the administrator
to cleanup this toolbar without having to install a macro/ComAddin or
anything of the sort.

Is this possible in vbscript? Can someone point me in the direction of
the OOM objects which are available in vbscript as opposed to VBA?

A small snippet of how I think the removal of the toolbar should work
is posted below.

---------------------------------------------------------------------------*-----

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Outlook", , FALSE, TRUE

Set myOlExp = objOutlook.ActiveExplorer
Set myCmdBars = myOlExp.CommandBars

mycbars.delete("My toolbar")

Wscript.Echo "done"
objOutlook.Quit


  #4  
Old March 25th 08, 01:46 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default vbscript to remove custom Outlook Toolbars

Extend.dat has nothing to do with addins or toolbars, it's where ECE's are
set (Exchange extensions written in C++ or Delphi using Extended MAPI).

The toolbar/menu customizations are held in a file outcmd.dat, which is also
reconstructed when Outlook starts if it's not there.

However, given that code as soon as that addin runs again the toolbar will
be back and deleting it with an outside script or by deleting outcmd.dat are
your main options. Of course depending on how the addin is written, if it
doesn't check for at least one Explorer when Outlook starts then your script
will start Outlook and the addin and the toolbar will be created then again.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"movalgirl" wrote in message
...
Thanks for the tip. Unfortunately, it is legacy code which creates
this permanent toolbar - new versions
only create the toolbar as a "temporary" toolbar. I have to work out
some way to automatically delete this permanent toolbar
during an upgrade of our software.


I am now using the following vbscript to delete the permanent toolbar.
The toolbar is deleted in the
current outlook session but at the next Outlook startup - there it is
again. Worse than the plague :-)

-----------------------------------------------------------------
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "","", FALSE, TRUE


Set oCBars = objOutlook.ActiveExplorer.CommandBars
For i = oCBars.Count To 1 Step -1
Wscript.Echo oCBars.Item(i).Name
If oCBars.Item(i).Name = "IXOSOST" Then
oCBars.Item(i).Delete
End If
Next


Wscript.Echo "done"
objOutlook.Quit
------------------------------------------------------------------------
p.s. i cannot simply delete the extend.dat file as the customer has
numerous
other addIns and not much of a sense of humour...

Thanks in advance,
movalgirl

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not save custom toolbars in Outlook 2000 allenh Outlook - Installation 1 October 25th 07 05:17 PM
Saving Custom Toolbars [email protected] Outlook - General Queries 0 October 16th 07 11:50 AM
How to add a button to a custom form with vbscript Robert Lindermeier - Your-Admin eK Outlook - Using Forms 3 February 26th 07 04:02 PM
VBScript to remove Outlook signatures Joseph Carew Outlook - General Queries 3 September 19th 06 09:19 AM
VBScript to remove Outlook signatures Brian Tillman Outlook and VBA 0 September 18th 06 01:38 PM


All times are GMT +1. The time now is 12:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.