Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

vbscript to remove custom Outlook Toolbars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
movalgirl - 20 Mar 2008 14:16 GMT
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
Ken Slovak - [MVP - Outlook] - 20 Mar 2008 14:42 GMT
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.

Signature

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

> Hi all,
>
[quoted text clipped - 24 lines]
> Wscript.Echo "done"
> objOutlook.Quit
movalgirl - 25 Mar 2008 13:56 GMT
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

------------------------------------------------
> Hi all,
>
[quoted text clipped - 24 lines]
> Wscript.Echo "done"
> objOutlook.Quit
Ken Slovak - [MVP - Outlook] - 25 Mar 2008 14:46 GMT
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.

Signature

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

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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.