Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wes Wes is offline
external usenet poster
 
Posts: 26
Default Tool bar to follow spreadsheet

Hi,

I've written few a macros that I want available on a toolbar. I've made the
toolbar with the buttons and it works fine. I also used the code below to
make the toolbar visible when you open the file and to remove it when you
close it, this also works fine. The problem I have is that when I email the
file to someone, or even simply rename it, it gives an error when you click
the button. It can't find the file. I tried re-assigning the button and
noticed that some of my macros have the file name in single quotes and the !
before the macro name. How do I fix this so that the button looks for the
macro within the open file, instead of looking in the file location where I
saved it when I first made it?

Thanks in advance for your help.

Wes

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Views").Visible = False
End Sub

Private Sub Workbook_Open()
Application.CommandBars("Views").Visible = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Tool bar to follow spreadsheet

Hi Wes

Create your complete menu with code when you open the file and delete it when you close the file.
See the following pages

Debra Dalgleish's (Toolbar example from Dave Peterson)
http://www.contextures.com/xlToolbar02.html

Creating Custom Menus (John Walkenbach)
http://www.j-walk.com/ss/excel/tips/tip53.htm

Ole P. Erlandsen's Web Site (Example workbooks)
http://www.erlandsendata.no/english/...oadcommandbars

How to customize menus and menu bars in Excel
http://support.microsoft.com/default...02&Product=xlw



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Wes" wrote in message ...
Hi,

I've written few a macros that I want available on a toolbar. I've made the
toolbar with the buttons and it works fine. I also used the code below to
make the toolbar visible when you open the file and to remove it when you
close it, this also works fine. The problem I have is that when I email the
file to someone, or even simply rename it, it gives an error when you click
the button. It can't find the file. I tried re-assigning the button and
noticed that some of my macros have the file name in single quotes and the !
before the macro name. How do I fix this so that the button looks for the
macro within the open file, instead of looking in the file location where I
saved it when I first made it?

Thanks in advance for your help.

Wes

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Views").Visible = False
End Sub

Private Sub Workbook_Open()
Application.CommandBars("Views").Visible = True
End Sub

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
How to view tool bars & tabs on spreadsheet windo Mark42954 Excel Discussion (Misc queries) 0 March 28th 10 04:55 PM
Problems with Spreadsheet Audit Tool ExcelMonkey Excel Discussion (Misc queries) 0 September 16th 05 05:00 PM
Does anyone know if there is a tool to document Excel Spreadsheet. Mike Kerr Excel Discussion (Misc queries) 0 December 15th 04 04:55 PM
Attaching toolbars to spreadsheet, but macros do not follow? JB Excel Programming 3 August 13th 04 09:48 PM
How to add a tool bar to a spreadsheet hlopes Excel Programming 3 September 13th 03 03:20 PM


All times are GMT +1. The time now is 08:02 AM.

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

About Us

"It's about Microsoft Excel"