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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Sub from class modules in word xp

Status
Not open for further replies.

keysjg

IS-IT--Management
Jul 17, 2003
1
US
I have created a sub routine that creates a command bar with one button. The code is located in the modules directory of my project. I am trying to call a public sub routine from a class module called SinkObject. SinkObject is the only class module located under the Class Modules directory. I am using the onAction method to call the sub. Word is giving me the error "The macro cannot be found or has been disabled because of macro security. Is this possible? am I doing this wrong?
Thanks for the help. Here is the code.

Public Sub iManageFooterCommandbar()

Dim objCommandBar As Office.CommandBar
Dim objCommandBarControl As Office.CommandBarControl
Dim objCommandBarButton As Office.CommandBarButton

For Each objCommandBar In Application.CommandBars

If objCommandBar.Name = "iManage Footer" Then

objCommandBar.Delete

End If

Next objCommandBar

Set objCommandBar = Application.CommandBars.Add _
("iManage Footer")

With objCommandBar.Controls

Set objCommandBarButton = .Add(msoControlButton)

With objCommandBarButton

.Caption = "iManag&e Footer"
.FaceId = 59
.Style = msoButtonIconAndCaption
.TooltipText = _
"Click here to insert iManage Footer."

End With

'The line below is where I believe the problem is occuring.
objCommandBarButton.OnActive = "SinkObject.ApplyFooter"
End With

objCommandBar.Visible = True

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top