+ Reply to Thread
Results 1 to 10 of 10

Open and close custom toolbar on startup/exit

  1. #1
    Registered User
    Join Date
    03-24-2006
    Posts
    38

    Open and close custom toolbar on startup/exit

    Hi,

    This might have been answered in another thread, but i couldn't find it.
    What do i need to do to open a custom toolbar when workbook opens, and close it when workbook close.
    Do i need to add AutoExec, AutoExit procedures?
    How do i "get" the toolbar?

    Thanks!

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon erikhs

    There are two ways of doing this. The easy way is to build a toolbar manually, and then close it. Once closed, the toolbar still exists, it's just hidden. You then have a macro in your ThisWorkbook module that sets its .,Visible property to true on opening and flase on closing.

    Please Login or Register  to view this content.
    The tricky way would be to build the toolbar "on the fly" every time the workbook is opened and delete it as the workbook is closed. This way is usually preferred because the toolbar would never be available to another workbook and would always be available to the workbook requiring it - whichever computer it would be opened on. Which one you go for depends on how comfortable you are with VBA coding.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    03-24-2006
    Posts
    38
    Quote Originally Posted by dominicb
    Good afternoon erikhs
    The tricky way would be to build the toolbar "on the fly" every time the workbook is opened and delete it as the workbook is closed. This way is usually preferred because the toolbar would never be available to another workbook and would always be available to the workbook requiring it - whichever computer it would be opened on. Which one you go for depends on how comfortable you are with VBA coding.

    HTH

    DominicB
    Good afternoon Dominic,

    I would definitely prefer to build the toolbar in vba, although i already have customized it in excel. I am quite comfortable with vba, just not with toolbars and Open/Close subs
    Perhaps you have a link to some VBA code for inspiration?

    Thank you!

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi erikhs

    Have a look at the code below, this will build a toolbar on opening and remove that toolbar on closing. If you are building your own toolbar you can only point to macros, not exisiting commands, but simple recorded macros are quite sufficient - that's the .OnAction command. Have a play and fire any questions back.

    Please Login or Register  to view this content.
    Don't forget to put this code in the ThisWorkbook module within the VBE.

    HTH

    DominicB

  5. #5
    Registered User
    Join Date
    03-24-2006
    Posts
    38
    Thanks Dominic!,

    I will try it out now, i think it is just what i was looking for!

  6. #6
    Registered User
    Join Date
    03-24-2006
    Posts
    38
    Hi Dominic,

    The code worked out great, however how do i create a custom button name, i.e. what faceid is it, and what property controls the displayed text of such a button?

  7. #7
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi erikhs

    What image is displayed is determined by the . FaceID control. To see a toolbar listing .FaceID images (there are several thousand such images) and the relevant reference number, download and install this add-in by Jim Rech :

    http://www.oaltd.co.uk/DLCount/DLCou...e=BtnFaces.zip

    When installed it will add an extra item to the tools menu to show the toolbar.

    HTH

    DominicB

  8. #8
    Registered User
    Join Date
    03-24-2006
    Posts
    38
    Quote Originally Posted by dominicb
    Hi erikhs

    What image is displayed is determined by the . FaceID control. To see a toolbar listing .FaceID images (there are several thousand such images) and the relevant reference number, download and install this add-in by Jim Rech :

    http://www.oaltd.co.uk/DLCount/DLCou...e=BtnFaces.zip

    When installed it will add an extra item to the tools menu to show the toolbar.

    HTH

    DominicB
    Hi,

    I think you misunderstood me, i would like to write the text that should be displayed ON the buttons. Example "MyButton 1", instead of in your example a "1". If i do it manually it's right click toolbar -> customize -> commands-> macro -> Custom Menu Item -> drag -> change name.

    Not the best description i know

  9. #9
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi erikhs

    Oh, OK. Try replacing the .FaceID with .Caption
    Please Login or Register  to view this content.
    HTH

    DominicB

  10. #10
    Registered User
    Join Date
    03-24-2006
    Posts
    38
    Quote Originally Posted by dominicb
    Hi erikhs

    Oh, OK. Try replacing the .FaceID with .Caption
    Please Login or Register  to view this content.
    HTH

    DominicB
    Back from some time off!

    That's excactly what i was looking for, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1