ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   executing an add in (https://www.excelbanter.com/excel-programming/344589-executing-add.html)

Gary Keramidas

executing an add in
 
created a form and saved it as an add-in. how do i call the form
userform1.show does not work. created a code module in the xls that opens
the form, but that module is not available as a macro.

i want to invoke the form from a button the toolbar.

thanks

--


Gary




Gary Keramidas

executing an add in
 
figured it out, in he assign macro i typed 'MyAddin.xla'!MyMacro and it
worked

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
created a form and saved it as an add-in. how do i call the form
userform1.show does not work. created a code module in the xls that opens
the form, but that module is not available as a macro.

i want to invoke the form from a button the toolbar.

thanks

--


Gary






Rowan Drummond[_3_]

executing an add in
 
Hi Gary

The normal way to access Add-In functionality is to use the Add-In's
workbook_open event to add menu items (or toolbar buttons) that call the
add-in's macros. These menu items are then removed again by the
workbook_BeforeClose event.

Hope this helps
Rowan

Gary Keramidas wrote:
created a form and saved it as an add-in. how do i call the form
userform1.show does not work. created a code module in the xls that opens
the form, but that module is not available as a macro.

i want to invoke the form from a button the toolbar.

thanks


Gary Keramidas

executing an add in
 
thanks rowan, sounds like the way to go. i found and adapted some code, but
it doesn't do anything/ i would like to have a button on the toolbar, just
don't know how to create it. here is the code i tried to use in the workbook
open even

Private Sub Workbook_Open()
Dim tBar, newButton

On Error Resume Next
CommandBars("FormEntry").Delete
CommandBars.Add Name:="FormEntry"

'set a variable to refer to the CommandBar
Set tBar = CommandBars("FormEntry")

'add a blank button to the CommandBar
Set newButton = tBar.Controls.Add

With newButton
.Caption = "Enter Data"
.OnAction = "Teller Form.xla!Run_Form"
End With
'make the CommandBar visible
With tBar
.Visible = True
.Left = 20
.Top = 20
End With
End Sub


--


Gary


"Rowan Drummond" wrote in message
...
Hi Gary

The normal way to access Add-In functionality is to use the Add-In's
workbook_open event to add menu items (or toolbar buttons) that call the
add-in's macros. These menu items are then removed again by the
workbook_BeforeClose event.

Hope this helps
Rowan

Gary Keramidas wrote:
created a form and saved it as an add-in. how do i call the form
userform1.show does not work. created a code module in the xls that opens
the form, but that module is not available as a macro.

i want to invoke the form from a button the toolbar.

thanks




Rowan Drummond[_2_]

executing an add in
 
Hi Gary

Your code created a toolbar for me but the caption did not show. I think
you need to set the button style. See the post here from Dave Peterson
regarding creating toolbars:
http://groups.google.co.uk/group/mic...6d67b1cc4a1f65

Hope this helps
Rowan

Gary Keramidas wrote:
thanks rowan, sounds like the way to go. i found and adapted some code, but
it doesn't do anything/ i would like to have a button on the toolbar, just
don't know how to create it. here is the code i tried to use in the workbook
open even

Private Sub Workbook_Open()
Dim tBar, newButton

On Error Resume Next
CommandBars("FormEntry").Delete
CommandBars.Add Name:="FormEntry"

'set a variable to refer to the CommandBar
Set tBar = CommandBars("FormEntry")

'add a blank button to the CommandBar
Set newButton = tBar.Controls.Add

With newButton
.Caption = "Enter Data"
.OnAction = "Teller Form.xla!Run_Form"
End With
'make the CommandBar visible
With tBar
.Visible = True
.Left = 20
.Top = 20
End With
End Sub



Gary Keramidas

executing an add in
 
thanks rowan. i guess the code did work, when i went to customize, all the
commandbars i created were listed there, they just weren't visible. the code
you pointed me to seems to work just fine. i don't need 3 buttons, i'll fix
that, but i got my form to fire when i click a button.

this way they can't click a button on the toolbar with the wrong workbook
open an generate an error. it will only be available when the workbooks with
this code attached.

thanks again.

--


Gary


"Rowan Drummond" wrote in message
...
Hi Gary

Your code created a toolbar for me but the caption did not show. I think
you need to set the button style. See the post here from Dave Peterson
regarding creating toolbars:
http://groups.google.co.uk/group/mic...6d67b1cc4a1f65

Hope this helps
Rowan

Gary Keramidas wrote:
thanks rowan, sounds like the way to go. i found and adapted some code,
but it doesn't do anything/ i would like to have a button on the toolbar,
just don't know how to create it. here is the code i tried to use in the
workbook open even

Private Sub Workbook_Open()
Dim tBar, newButton

On Error Resume Next
CommandBars("FormEntry").Delete
CommandBars.Add Name:="FormEntry"

'set a variable to refer to the CommandBar
Set tBar = CommandBars("FormEntry")

'add a blank button to the CommandBar
Set newButton = tBar.Controls.Add

With newButton
.Caption = "Enter Data"
.OnAction = "Teller Form.xla!Run_Form"
End With
'make the CommandBar visible
With tBar
.Visible = True
.Left = 20
.Top = 20
End With
End Sub



Rowan Drummond[_3_]

executing an add in
 
You're welcome Gary.

One thing to note if you choose to use a toolbar rather than a menu is
that depending on the settings you specify the user could close the
toolbar meaning that they have no way to activate the form aside from
closing and reopening the workbook.

Regards
Rowan

Gary Keramidas wrote:
thanks rowan. i guess the code did work, when i went to customize, all the
commandbars i created were listed there, they just weren't visible. the code
you pointed me to seems to work just fine. i don't need 3 buttons, i'll fix
that, but i got my form to fire when i click a button.

this way they can't click a button on the toolbar with the wrong workbook
open an generate an error. it will only be available when the workbooks with
this code attached.

thanks again.



All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com