Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Fernando Gomez
 
Posts: n/a
Default Macro not working with Excel 2003

I just upgraded excel 97 to 2003 and I was using some macros saved in
Personal.xls, but now I lost all the custom toolbar that I had before, and
this Macro does not work it says "Can not find prject or library" (macro is
to have 1 custom menu) and stop in Type:=msoControlPopup.

Sub Auto_Open()

Dim NewMenu As Object
Dim SubMenu As Object
Dim ToolBarActivate As Object

Set NewMenu = CommandBars.FindControl(Type:=msoControlPopup, _
Tag:="AuditPack")
If NewMenu Is Nothing Then
Set ToolBarActivate = CommandBars.ActiveMenuBar
Set NewMenu = ToolBarActivate.Controls.Add(Type:=msoControlPopup ,
Temporary:=True)
NewMenu.Caption = "CompX Menu"
NewMenu.Tag = "CompX Menu"
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "ID File - Sheet"
.OnAction = "UpdateFooter"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "ID File - Workbook"
.OnAction = "UpdateFooters"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "Page break - View"
.OnAction = "ToggleViews"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
Set CommandBarActiva = Nothing
Set NewMenu = Nothing
Set SubMenu = Nothing
End If

End Sub

Could somebody help me to fix this and understand how Excel 2003 keeps the
toolbar (
Before it was in Excel8.xlb)

Thanks


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

First, your code almost worked for me.

This line:
Set CommandBarActiva = Nothing
should be replaced with:
Set ToolBarActivate = Nothing

It could mean that you're missing a reference in your personal.xls project.

Inside the VBE with personal.xls the active project, click on Tools|References.
Look to see if "microsoft office 11.0 object library" is checked (11.0 is for
xl2003, IIRC).

If it's checked can you try your workbook on a different pc. If it works there,
check the references and come back and match those in the troublesome pc.




Fernando Gomez wrote:

I just upgraded excel 97 to 2003 and I was using some macros saved in
Personal.xls, but now I lost all the custom toolbar that I had before, and
this Macro does not work it says "Can not find prject or library" (macro is
to have 1 custom menu) and stop in Type:=msoControlPopup.

Sub Auto_Open()

Dim NewMenu As Object
Dim SubMenu As Object
Dim ToolBarActivate As Object

Set NewMenu = CommandBars.FindControl(Type:=msoControlPopup, _
Tag:="AuditPack")
If NewMenu Is Nothing Then
Set ToolBarActivate = CommandBars.ActiveMenuBar
Set NewMenu = ToolBarActivate.Controls.Add(Type:=msoControlPopup ,
Temporary:=True)
NewMenu.Caption = "CompX Menu"
NewMenu.Tag = "CompX Menu"
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "ID File - Sheet"
.OnAction = "UpdateFooter"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "ID File - Workbook"
.OnAction = "UpdateFooters"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
With SubMenu
.Caption = "Page break - View"
.OnAction = "ToggleViews"
End With
Set SubMenu = NewMenu.Controls.Add(Type:=msoControlButton, Id:=1)
Set CommandBarActiva = Nothing
Set NewMenu = Nothing
Set SubMenu = Nothing
End If

End Sub

Could somebody help me to fix this and understand how Excel 2003 keeps the
toolbar (
Before it was in Excel8.xlb)

Thanks


--

Dave Peterson
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
Creating GIFs in Excel 2003 for use in Dreamweaver Lou Crandall Charts and Charting in Excel 2 January 2nd 05 08:58 PM
Saving a Excel 97 file into Excel 2003 file Wil Excel Discussion (Misc queries) 1 December 14th 04 12:51 AM
Opening and saving Excel 2003 file from Excel 97. Rodrigo Excel Discussion (Misc queries) 2 December 12th 04 03:17 PM
Stock Quotes in Excel 2003 David B. Excel Discussion (Misc queries) 0 December 1st 04 09:41 PM
Excel 2003 Database Driver Visual FoxPro 7 on Server 2003. Cindy Winegarden Excel Discussion (Misc queries) 0 November 28th 04 01:07 AM


All times are GMT +1. The time now is 05:41 AM.

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"