Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert an xls macro to an add-in 1

Status
Not open for further replies.

Adnane

Technical User
Apr 22, 2003
88
EU
Hi,

i have devolped a macro under Excel and i was wondering if there was a way to convert this macro to an add-in so that it'll much simpler for its users. otherwise, now they have to import the module each time before they can start using it.

Regards,

Adnane
 
Thanks a lot carr that's what i was looking for. however another problem arises for me here.
now that i have my add-in how can i run it. in other words how can i get what the macro does done.

Adnane
 
On second thought, why not put the macro in users' personal.xls files and attach teh macro to a Custom button on their Excel toolbars?
 
i would appreciate help on doing this :)
 
i found out how to save on personal.xls and it works great. thanks carr once again.

Regards,

Adnane
 
Sure. There are probably other ways to pull this off, but this is how I do it.
Once I've recorded the macro, I open the Visual Basic Editor (Alt+F11) and select my macro, right clicking on it. I choose "Export File" and save it to a floppy (or a network folder). It will save with a .bas extension.

I then go to the client machine, open their Excel, open their Visual Basic Editor, select their Personal.xls, right click, select "Import File" and bring in the file from floppy or network drive.

Now that the macro is there, go to View > Toolbars > Customize. Choose the Commands tab. Select Macros from the "Categories" window. From the "Commands" window on the right side, select and drag the "Custom button" up to one of your existing toolbars. Once you've set it there, click "Modify Selection" in the Customize gui and Assign Macro abd Change Button Image if you so desire.

That should do it...
 
Hi,

To be able to use your AddIn, you must have a menu. Create code in the module “ThisWorkbook”, like that:

Private Sub Workbook_AddinInstall()
With Application.CommandBars.Add("MyTool", , False, True)
.Visible = True
.Position = msoBarTop
With .Controls
With .Add(msoControlButton)
.Caption = "Split"
.OnAction = "SepName"
End With
End With
End With
End Sub

Private Sub Workbook_AddinUninstall()
Application.CommandBars("MyTool").Delete
End Sub



Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Parfait!!
Thanks a lot Jean-Paul. here's a star for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top