LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Add-In - OnAction Can't Find Macro & Subs Doesn't Affect Current Wkb

I am working on and add-in that deletes empty rows and columns for
sorting and subtotalling. The data is generated from a Crystal Report.


I manually run the code to generate the menu item and then am hoping
that the procedure will execute on any new sheet.

I am having two problems with the Add-In
A) When I click on the menu item, I get an error that the macro can't
be found - "The macro 'ClearSheet.xla!CleanSheet' cannot be found"
B) Executing the the code in the Add-In doesn't seem to delete the rows
and columns in the new workbook. I have to copy the code over to the
new workbook and then run the code from there.

Here is the code:

Public Sub CreateMenu()
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuItem As CommandBarControl
Dim SubMenuItem As CommandBarButton

Call DeleteMenu

Set HelpMenu = Application.CommandBars(1).FindControl(ID:=30010)

'If Help Menu doesn't exist add to end of menu items
If HelpMenu Is Nothing Then
Set NewMenu =
Application.CommandBars(1).Controls.Add(Type:=msoC ontrolPopup,
temporary:=False)
Else
Set NewMenu =
Application.CommandBars(1).Controls.Add(Type:=msoC ontrolPopup,
Befo=HelpMenu.Index, temporary:=False)
End If

NewMenu.Caption = "Reporting"

'First Menu Item
Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)

With MenuItem
..Caption = "Gross &Margin by Part ID"
..OnAction = "CleanSheet"
End With

End Sub

Sub DeleteMenu()
On Error Resume Next
CommandBars(1).Controls("Reporting").Delete
End Sub

Public Sub CleanSheet()
Deleted for brevity
(Code that deletes empty rows and columns)
End Sub

 
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
Macro to affect all sheets REMB Excel Discussion (Misc queries) 3 June 4th 10 09:03 PM
find current data with macro Francesco Magagnino Excel Discussion (Misc queries) 2 September 5th 08 11:21 AM
How can I Run a query from VB macro with out affect current data in the same sheet? oafdl Excel Discussion (Misc queries) 0 May 29th 06 09:42 PM
OnAction Cannot find Macro ?? Andrew Kennard Excel Programming 5 December 22nd 04 03:17 PM
Find OnAction property Kemosabe Excel Programming 1 November 21st 03 03:34 PM


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