Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Code not Working - Help please

I am using code to set up the CommandBars when opening an
application in Excel 2000. It is working fine on my PC,
but when this is opened on another PC also using Excel
2000,via CD or floppy, I get the following error
message "Microsoft Visual Basic - Complie Error - Can't
find project or library"

Can any one please tell me why I am getting this error.

The code I am using is as follows:

Private Sub Workbook_Activate()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("MyMenuBar").Visible = False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("MyMenuBar").Visible = False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Open()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

This code is to close all existing toolbars and open
MyMenuBar only on open or when screen is active, then
when not active or on close it resets to the original
menus and toolbars.

The debugger highlights the Private Sub Workbook_Open()
line first them changes to each other first line of each
procedure.

Any help appreciated, thanks in advance.

Brian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code not Working - Help please

after you get it, go to the vbe and look in tools=references. You should
see one or more references marked MISSING.

That is your problem. That is the library it can't find.

--
Regards,
Tom Ogilvy

"Brian" wrote in message
...
I am using code to set up the CommandBars when opening an
application in Excel 2000. It is working fine on my PC,
but when this is opened on another PC also using Excel
2000,via CD or floppy, I get the following error
message "Microsoft Visual Basic - Complie Error - Can't
find project or library"

Can any one please tell me why I am getting this error.

The code I am using is as follows:

Private Sub Workbook_Activate()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("MyMenuBar").Visible = False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("MyMenuBar").Visible = False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Open()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

This code is to close all existing toolbars and open
MyMenuBar only on open or when screen is active, then
when not active or on close it resets to the original
menus and toolbars.

The debugger highlights the Private Sub Workbook_Open()
line first them changes to each other first line of each
procedure.

Any help appreciated, thanks in advance.

Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Code not Working - Help please

Many thanks Tom, found the missing file, mscal.ocx,
loaded and all working fine.

Brian

-----Original Message-----
after you get it, go to the vbe and look in

tools=references. You should
see one or more references marked MISSING.

That is your problem. That is the library it can't find.

--
Regards,
Tom Ogilvy

"Brian" wrote in

message
...
I am using code to set up the CommandBars when opening

an
application in Excel 2000. It is working fine on my PC,
but when this is opened on another PC also using Excel
2000,via CD or floppy, I get the following error
message "Microsoft Visual Basic - Complie Error - Can't
find project or library"

Can any one please tell me why I am getting this error.

The code I am using is as follows:

Private Sub Workbook_Activate()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("MyMenuBar").Visible =

False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("MyMenuBar").Visible =

False
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = True
End If
Next cbar
End Sub

Private Sub Workbook_Open()
Application.CommandBars("MyMenuBar").Visible = True
For Each cbar In Application.CommandBars
If cbar.Name < "MyMenuBar" Then
cbar.Enabled = False
End If
Next cbar
End Sub

This code is to close all existing toolbars and open
MyMenuBar only on open or when screen is active, then
when not active or on close it resets to the original
menus and toolbars.

The debugger highlights the Private Sub Workbook_Open()
line first them changes to each other first line of

each
procedure.

Any help appreciated, thanks in advance.

Brian



.

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
Code not working and can't see why Steve Excel Discussion (Misc queries) 3 December 31st 04 03:12 PM
why this code not working tj Excel Programming 0 September 2nd 03 07:14 PM
why this code not working Bernie Deitrick[_2_] Excel Programming 0 September 2nd 03 05:08 PM
Code not working Bob Phillips[_5_] Excel Programming 5 August 14th 03 03:12 PM
For Each Code Not Working jacqui[_2_] Excel Programming 4 July 29th 03 02:44 AM


All times are GMT +1. The time now is 03:04 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"