Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to distribute custom toolbar updates?

Has anyone run across a clean and automated way to distribute an Excel
workbook application containing an updated attached toolbar -- such that
it will replace any previous toolbar of the same name in a user's Excel
workspace on their PC? Everything I've seen so far suggests that one
must first delete any same named toolbar in the local Excel workspace
BEFORE the custom Excel application is loaded-- at which point any
attached custom toolbar will again be copied to the local PC. Which is
fine, and works, but is not very elegant for distribution purposes.

Any thoughts??? Much appreciated!! Larry.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default How to distribute custom toolbar updates?

Hi Larry,

I know this really doesn't answer your question, but I've found attached
toolbars to be a real nuisance. I think it's much cleaner to build your
toolbar dynamically each time your app is opened and delete it when your app
is closed.

You should always build logic into your Auto_Open (or Workbook_Open)
procedure to delete any previously existing toolbars of the same name prior
to building the toolbar for your application, in case a previous version was
left behind by a crash or some other incomplete exit of your program, and
this will also take care of any left over attached toolbars.

So a skeleton of the logic would look something like this:

Sub Auto_Open()
Dim cbrBar As CommandBar
Dim ctlControl As CommandBarControl
On Error Resume Next
''' Remove any pre-existing version of the toolbar.
CommandBars("MyToolbar").Delete
On Error GoTo 0
''' Build the new toolbar.
Set cbrBar = CommandBars.Add("MyToolbar", False)
Set ctlControl = cbrBar.Controls.Add(msoControlButton)
'''....etc....
End Sub

Sub Auto_Close()
On Error Resume Next
''' Remove the toolbar on exit.
CommandBars("MyToolbar").Delete
On Error GoTo 0
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Larry Adams" wrote in message
...
Has anyone run across a clean and automated way to distribute an Excel
workbook application containing an updated attached toolbar -- such that
it will replace any previous toolbar of the same name in a user's Excel
workspace on their PC? Everything I've seen so far suggests that one
must first delete any same named toolbar in the local Excel workspace
BEFORE the custom Excel application is loaded-- at which point any
attached custom toolbar will again be copied to the local PC. Which is
fine, and works, but is not very elegant for distribution purposes.

Any thoughts??? Much appreciated!! Larry.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to distribute custom toolbar updates?

Rob, I agree that is a clean approach, but it leaves me with at least one
problem still. When one builds a toolbar by hand, Excel allows one to create a
customized control icon image in addition to assigning a text "name". Is there
any way to use these user designed icons images on dynamically built toolbars?
And would there be any similar distribution issues?

Or,... do I need to consider building my own icon images via some 3rd party icon
program? (And, if so, any suggestions?) (Or is there a good library of images
available from somewhere that might work?) Also,...

.... would there be any way to embed these separately developed icon images
directly into the Excel template so as not to need to distribute icon files
along with the Excel app itself? The main reason being that this app may be
accessed through an intranet web page and I think I will need the Exel app to be
fully self contained. I know one can paste images into Excel, but can these
images be named and referenced?

Many thanks! Larry.

Rob Bovey wrote:

Hi Larry,

I know this really doesn't answer your question, but I've found attached
toolbars to be a real nuisance. I think it's much cleaner to build your
toolbar dynamically each time your app is opened and delete it when your app
is closed.

You should always build logic into your Auto_Open (or Workbook_Open)
procedure to delete any previously existing toolbars of the same name prior
to building the toolbar for your application, in case a previous version was
left behind by a crash or some other incomplete exit of your program, and
this will also take care of any left over attached toolbars.

So a skeleton of the logic would look something like this:

Sub Auto_Open()
Dim cbrBar As CommandBar
Dim ctlControl As CommandBarControl
On Error Resume Next
''' Remove any pre-existing version of the toolbar.
CommandBars("MyToolbar").Delete
On Error GoTo 0
''' Build the new toolbar.
Set cbrBar = CommandBars.Add("MyToolbar", False)
Set ctlControl = cbrBar.Controls.Add(msoControlButton)
'''....etc....
End Sub

Sub Auto_Close()
On Error Resume Next
''' Remove the toolbar on exit.
CommandBars("MyToolbar").Delete
On Error GoTo 0
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *

"Larry Adams" wrote in message
...
Has anyone run across a clean and automated way to distribute an Excel
workbook application containing an updated attached toolbar -- such that
it will replace any previous toolbar of the same name in a user's Excel
workspace on their PC? Everything I've seen so far suggests that one
must first delete any same named toolbar in the local Excel workspace
BEFORE the custom Excel application is loaded-- at which point any
attached custom toolbar will again be copied to the local PC. Which is
fine, and works, but is not very elegant for distribution purposes.

Any thoughts??? Much appreciated!! Larry.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to distribute custom toolbar updates?

Paste on a sheet,
select the image, rename it using the name box in the upper left corner.

Make the sheet hidden.

In your code, copy the image to the clipboard and use pasteface to put it on
your menu button.

--
Regards,
Tom Ogilvy

"Larry Adams" wrote in message
...
Rob, I agree that is a clean approach, but it leaves me with at least one
problem still. When one builds a toolbar by hand, Excel allows one to

create a
customized control icon image in addition to assigning a text "name". Is

there
any way to use these user designed icons images on dynamically built

toolbars?
And would there be any similar distribution issues?

Or,... do I need to consider building my own icon images via some 3rd

party icon
program? (And, if so, any suggestions?) (Or is there a good library of

images
available from somewhere that might work?) Also,...

... would there be any way to embed these separately developed icon images
directly into the Excel template so as not to need to distribute icon

files
along with the Excel app itself? The main reason being that this app may

be
accessed through an intranet web page and I think I will need the Exel app

to be
fully self contained. I know one can paste images into Excel, but can

these
images be named and referenced?

Many thanks! Larry.

Rob Bovey wrote:

Hi Larry,

I know this really doesn't answer your question, but I've found

attached
toolbars to be a real nuisance. I think it's much cleaner to build your
toolbar dynamically each time your app is opened and delete it when your

app
is closed.

You should always build logic into your Auto_Open (or Workbook_Open)
procedure to delete any previously existing toolbars of the same name

prior
to building the toolbar for your application, in case a previous version

was
left behind by a crash or some other incomplete exit of your program, an

d
this will also take care of any left over attached toolbars.

So a skeleton of the logic would look something like this:

Sub Auto_Open()
Dim cbrBar As CommandBar
Dim ctlControl As CommandBarControl
On Error Resume Next
''' Remove any pre-existing version of the toolbar.
CommandBars("MyToolbar").Delete
On Error GoTo 0
''' Build the new toolbar.
Set cbrBar = CommandBars.Add("MyToolbar", False)
Set ctlControl = cbrBar.Controls.Add(msoControlButton)
'''....etc....
End Sub

Sub Auto_Close()
On Error Resume Next
''' Remove the toolbar on exit.
CommandBars("MyToolbar").Delete
On Error GoTo 0
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *

"Larry Adams" wrote in message
...
Has anyone run across a clean and automated way to distribute an Excel
workbook application containing an updated attached toolbar -- such

that
it will replace any previous toolbar of the same name in a user's

Excel
workspace on their PC? Everything I've seen so far suggests that one
must first delete any same named toolbar in the local Excel workspace
BEFORE the custom Excel application is loaded-- at which point any
attached custom toolbar will again be copied to the local PC. Which

is
fine, and works, but is not very elegant for distribution purposes.

Any thoughts??? Much appreciated!! Larry.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to distribute custom toolbar updates?

Just as an FYI, to expand on Tom's reply, I have found that I do not need to go to a
3rd party icon program -- as Excel's toolbar "Customize" option allows one to go to
the "Command" tab, select "Modify Selection", click on your target toolbar button,
and then select "Copy Button Image", which one can then paste directly onto a
spreadsheet tab and name. Which is a nice self-contained solution -- and also
guarantees that there will be no sizing or other compatibility issues. Thanks.

Larry Adams wrote:

... do I need to consider building my own icon images via some 3rd party icon
program? (And, if so, any suggestions?) (Or is there a good library of images
available from somewhere that might work?) Also,...

... would there be any way to embed these separately developed icon images
directly into the Excel template so as not to need to distribute icon files
along with the Excel app itself?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom toolbar dml Excel Discussion (Misc queries) 1 March 17th 10 02:02 PM
VBA custom toolbar donwb Excel Discussion (Misc queries) 3 January 22nd 10 05:30 PM
VBA custom toolbar donwb Excel Discussion (Misc queries) 0 December 28th 09 01:15 AM
Custom Toolbar user Excel Discussion (Misc queries) 1 March 17th 09 05:33 AM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"