On Apr 4, 8:54*am, Nils Titley <NilsTit...@discussions.microsoft.com>
wrote:
> Chris,
>
> You have actually created more problems... but good. *Now that it is working.
>
> 1) Where do I get a list that tells me the relationship between the faceID
> and what bitmap I will see so I can pick my own image?
> 2) How do I attach my add-in to the button?
> 3) I have my macro that processes. *I can place this call for the buttonat
> the very top of the macro and then it will exit my add-in after the process
> macro has completed?
>
> Thanks for your help.
>
>
>
> "cht13er" wrote:
> > On Apr 4, 6:50 am, Nils Titley <NilsTit...@discussions.microsoft.com>
> > wrote:
> > > I am getting a run time error 5, Invalid procedure at
>
> > > Application.CommandBars("ButtonMe").Controls.Add(Type:=msoControlButton, _
> > > * * * * * * * ID :=2950, Before:=1)
>
> > > I tried finding the problem but I am not use to using this code. *Any
> > > suggestions as to what is wrong.
>
> > > Thanks
>
> > > "cht13er" wrote:
> > > > On Apr 3, 6:05 pm, Nils Titley <NilsTit...@discussions.microsoft.com>
> > > > wrote:
> > > > > Thanks for responding.
>
> > > > > I am not creating any menus or buttons. *Can I create a menu button that
> > > > > will run the add-in? *Or how about a ctrl-chr?
>
> > > > > The macro processes files, creates a report and moves the data files to
> > > > > archive them.
>
> > > > > Thanks
>
> > > > > "cht13er" wrote:
> > > > > > On Apr 3, 5:03 pm, Nils Titley <NilsTit...@discussions.microsoft..com>
> > > > > > wrote:
> > > > > > > Once you have a macro and have decided to make an AddIn, how do you
> > > > > > > distribute that AddIn to other uses. *For example I am in the USA, the users
> > > > > > > will be South Africa?
>
> > > > > > > Thanks
>
> > > > > > You ensure that the .xla file creates all the menus and buttons,etc.
> > > > > > in the open() sub that you need ...
> > > > > > Then you password-protect the code, and email it off!
>
> > > > > > All they have to do is Tools->Ad-ins->Browse to select the file that
> > > > > > you send to them.
>
> > > > > > HTH
>
> > > > > > Chris
>
> > > > see if this doesn't help ... this is stored in the ThisWorkbook of
> > > > the .xla addin.
>
> > > > Private Sub Workbook_Open()
>
> > > > 'Called when this workbook is opened
> > > > 'Delete it if it already exists
> > > > * * On Error Resume Next
> > > > * * Application.CommandBars("NameMe").Delete
> > > > * * On Error GoTo 0
>
> > > > 'Create the toolbar
> > > > * * Set Combar = Application.CommandBars.Add(Name:="NameMe",
> > > > Position:=msoBarTop)
> > > > * * Combar.Visible = True
>
> > > > 'Create button
> > > > * * Application.CommandBars("NameMe").Visible = True
> > > > * * Set myControl =
> > > > Application.CommandBars("ButtonMe").Controls.Add(Type:=msoControlButton,
> > > > ID _
> > > > * * * * :=2950, Before:=1)
>
> > > > With myControl
> > > > * * .OnAction = "CodeModule.CodeName"
> > > > * * .FaceId = 111
> > > > * * .Tag = "HI"
> > > > * * .Caption = "HI"
> > > > * * .Style = msoButtonIconAndCaption
> > > > End With
> > > > ..
>
> > > > ..
>
> > > > ..
>
> > > > ..
>
> > > > End Sub
>
> > > > HTH
>
> > > > Chris
>
> > Oops!
> > I renamed everything to TRY to make it easier ... hehe .. as you see,
> > the CommandBar is named "NameMe" - so fix that type ... the button
> > gets named in the next bit of code.
>
> > Cheers (and sorry about that!)
>
> > Chris- Hide quoted text -
>
> - Show quoted text -
Aha! Now it gets fun

1) There are loads of add-ins for FaceIds - I use the "JWalk FaceID
Identifier" - google it

2) The code to create the commandbar and button(s) is in Private Sub
Workbook_Open() in ThisWorkbook.
the part "With myControl
.OnAction = "CodeModule.CodeName""
tells that particular button to go to a codemodule named "codemodule"
and run the sub called "codename".
3) So then you should place the code "that processes" in a module, in
"codename" so that when a user wants to run the code, (s)he hits the
button, and voila!
HTH
Chris