View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Add-in AND Macros Not Showing Up in New Book

I don't see any Auto_New in that code.

You sure you didn't change it to match what you do in MSWord and then had to
change it back?

SkyEyes wrote:

Option Explicit

Public Const ToolBarName As String = "MyToolbarName"
'===========================================
Sub Auto_Open()
Call CreateMenubar
End Sub

'===========================================
Sub Auto_Close()
Call RemoveMenubar
End Sub

'===========================================
Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub

'===========================================
Sub CreateMenubar()

Dim iCtr As Long

Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant

Call RemoveMenubar

MacNames = Array("aaa", _
"bbb")

CapNamess = Array("AAA Caption", _
"BBB Caption")

TipText = Array("AAA tip", _
"BBB tip")

With Application.CommandBars.Add
.Name = ToolBarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating

For iCtr = LBound(MacNames) To UBound(MacNames)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Caption = CapNamess(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = 71 + iCtr
.TooltipText = TipText(iCtr)
End With
Next iCtr
End With
End Sub

'===========================================
Sub AAA()
MsgBox "aaa"
End Sub

'===========================================
Sub BBB()
MsgBox "bbb"
End Sub

"Dave Peterson" wrote:

Was there someplace that said you should use auto_new as the procedure name?

SkyEyes wrote:

Thanks..this is the piece we were missing that you have to set up a button on
a toolbar (build one on the fly or whatever) that is linked to that macro.
Works perfectly, except instead of AUTO_NEW had to utilize _OPEN.

Thanks again!!

"Jim Cone" wrote:


Even though the macro name does not appear in the Macros list,
you can still enter the macro name and click Run to run the code.

On the other hand, the usual way is to have code in the add-in that
creates a button/toolbar when the add-in is opened and removes
the button/toolbar when the add-in closes.
There are instructions here... http://www.contextures.on.ca/xlToolbar02.html
--
Jim Cone


"SkyEyes"
wrote in message
Yes...this was set to true. Does the macro have to be attached to a toolbar
or should I be able to open another workbook and select Tools | Macros and
see the macro from the add-in? It is not hidden/protected or anything. That
is why I'm wondering if there is a setting.
We've going through all the documentation on creating an excel add-in and
according to this documentation we are doing everything fine.


"Jim Cone" wrote:
In the VBE, you can press F4 or go to the menu: View | Properties window.
If you have the correct workbook (project) selected, then selecting "ThisWorkbook"
displays the properties for the workbook. They are in alphabetical order.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"SkyEyes"
wrote in message
Where do I set this. If I go into the code (actually open just the XLA file,
and go into VBA, I cannot locate where you set the property to an add-in).
HELP??



--

Dave Peterson


--

Dave Peterson