ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleting toolbars (https://www.excelbanter.com/excel-programming/291535-deleting-toolbars.html)

DVS

deleting toolbars
 
Hi,

I need some help with how to manage the deletion of a custom toolbar
in Excel. I am creating the toolbar from the workbook when the
workbook is opened and deleting it when is closed.

The problem is that the user could create different workbooks from the
one I am distributing(utilizing save as) and have them open at the
same time. What I am notising is that when the user closes any of the
workbooks the toolbar dissappears form thr other opened workbooks
,however, I need the tool bar to be still displayed in each individual
workbook as the user could still be using it.

Any suggestion on how to make the toolbar stay for each opened file
that is a copy of the original workbook, without having to create an
add in?

thanks

dvs

Jim Rech

deleting toolbars
 
I would suggest that a workbook only delete the toolbar if it is the only
workbook open created from your template. I think you could identify such
workbooks by a defined name that is present in them, but not likely in other
workbooks. For example:

Sub CloseToolBar()
Dim WB As Workbook
Dim NamesCounter As Integer
Dim Dummy As String
On Error GoTo NoName
For Each WB In Workbooks
Dummy = WB.Names("MyTemplateSpecialName").Value
NamesCounter = NamesCounter + 1
NextWB:
Next
If NamesCounter = 1 Then DoDeleteTB ''Only in this workbook
Exit Sub
NoName:
Resume NextWB
End Sub


--
Jim Rech
Excel MVP



David Fixemer

deleting toolbars
 
I have solved similar problems, however, could use a
little more information. When you open numerous copies of
the workbook, do you get numerous toolbars? If no, why
not?

David Fixemer

DVS

deleting toolbars
 
"david fixemer" wrote in message ...
I have solved similar problems, however, could use a
little more information. When you open numerous copies of
the workbook, do you get numerous toolbars? If no, why
not?

David Fixemer


If I open two different workbooks that were created form the same
template (or original workbook) with the same exact VBA code, there is
a toolbar for each window of excel (or opened workbook). If I comment
out the delete toolbar code, the toolbar on which window stays when
one of the other workbooks is closed. however, there is an empty
toolbar on any other file that I create or open afterwords if they are
not from the original tmeplate (workbook) that contained the code.

thanks

dvs


All times are GMT +1. The time now is 04:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com