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 / April 2005

Tip: Looking for answers? Try searching our database.

How to programmatically change  caption of macro custom button on Outlook command toolbar with VBA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rj - 27 Apr 2005 06:06 GMT
Outlook 2002 on Home XP sp2

I'm a newbie with VBA programming and the Outlook Object structure etc.

I used Tools/Customize/Commands/Macros to select a macro
(Project1.ThisOutlookSession.MyFormMarcro) I'd written to create a Custom
Button on the Outlook command toolbar to execute the macro when the button
is clicked.

The macro brings up a User Form where I enter some info.  Depending on what
I enter I'd like to change the macro button caption when I close the form.

My question is can I programmatically change the macro button caption with
VBA?  How do I do it?

Also, the macro button data is persistent so where is it stored? (registry,
an Outlook or Office data file?). I'd like to backup this data also when I
do my regular backup of my outlook.pst file and MS Office documents.

thanks
rj
Eric Legault [MVP - Outlook] - 28 Apr 2005 22:26 GMT
You can get a reference to your custom button by name, depending on which
command bar you've stored it on:

   Dim objStandardBar As Office.CommandBar
   Dim objMyButton As Office.CommandBarButton

   Set objStandardBar = ActiveExplorer.CommandBars("Standard")
   Set objMyButton = objStandardBar.Controls("MyButton")
   objMyButton.Caption = "My New Caption"

Custom toolbar data is stored in the "C:\Documents and
Settings\[USERNAME]\Application Data\Microsoft\Outlook\outcmd.dat" file.  The
best way to preserve this and other data is to run the Office Save My
Settings Wizard (in the Microsoft Office Tools program group).

Signature

Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> Outlook 2002 on Home XP sp2
>
[quoted text clipped - 17 lines]
> thanks
> rj
rj - 29 Apr 2005 03:50 GMT
Thats perfect, thanks!  I didn't realize I had to use the ActiveExplorer
Object for Outlook.  Thanks for the outcmd.dat and Save My Settings info.
Thanks
rj

> You can get a reference to your custom button by name, depending on which
> command bar you've stored it on:
 
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.