Not yet... I added the macros as menu functions and changed the build of the
custom toolbarbuttons as shown below.
Dim i As Long
Dim mac_names As Variant
Dim cap_names As Variant
Dim tip_text As Variant
Dim face_names As Variant
mac_names = Array("init_rpt", _
"printem", _
"print_draft_copy", _
"print_blank_page")
cap_names = Array("Initialize Form", _
"Audit && Print", _
"Draft Page", _
"Blank Form ONLY")
tip_text = Array("Clear Form or change form number", _
"Audit, then Print activesheet", _
"Draft Page for review - Not audited", _
"Blank Form to be handwritten")
face_names = Array("Init_form", _
"Audit_Print", _
"print_draft", _
"prt_blank")
With Application.CommandBar.Add
.Name = "EXPRPT"
.Protection = msoBarNoProtection
For i = LBound(mac_names) To UBound(mac_names)
Sheets("TRANS").DrawingObjects(face_names(i)).Copy
With .Controls.Add(Type:=msoControlButton)
.OnAction = ThisWorkbook.Name & "!" & mac_names(i)
.Caption = cap_names(i)
.Style = msoButtonIconAndCaption
.PasteFace
.TooltipText = tip_text(i)
End With
Next i
End With
and initial reports from users indicated that the buttons were working.
However, just a couple weeks ago, someone else reported that their file was
erroring by trying to open duplicate instance again, so it didn't work for
everyone.
As a workaround, the users can run the macros by using Tools / Macro /
Macros / Run but it would be so much nicer for the buttons to work. I wish I
knew what the government computers are doing to Excel to cause this
behavior...
"tfreeman" wrote:
Ellen,
Did you ever figure out your problem? I am having the same issue.
Thanks!
"EllenR" wrote:
Thanks for the links. If I can't find any other answer, I may have to switch
from buttons to the menubar approach. I like the custom buttons, though,
because I can paste my own icons on the faces, rather than just using
standard faces.
My code is very similar to the create toolbar code in the second link. The
workbook has used the same code to create the toolbar for over a year now,
since I upgraded it from the Excel 5.0 toolbarbuttons commands to use the
Commandbar commands.
So this aberrant behavior is really puzzling and frustrating to solve,
especially since I can't make it happen on any computers I use. It
apparently only affects a small group of the 1000+ employees who use the
form, but they are a very vocal group. My next tactic will be to find some
commonality among the users who get the error.
"Dave Peterson" wrote:
John Walkenbach has a technique to add items to the worksheet menubar at:
http://j-walk.com/ss/excel/tips/tip53.htm
If you really want a toolbar, here's how I do it:
http://groups.google.co.uk/groups?th...5B41%40msn.com
It builds the toolbar when the workbook opens and deletes it when the workbook
closes.
EllenR wrote:
I've never worked with addins, so that will be a learning curve. Also, my
users at government sites may not be allowed to install an addin, so having
the macros run from within the file is the easiest method...except when it
doesn't work.
I'm using the Commandbars commands to create the custom toolbar, rather than
the old Toolbarbuttons commands. Would it be worth changing back to the old
code, which worked fine for years?
"MarkHG" wrote:
Ellen
Are the macro's/the form in an addin?
If not this is probably the way to go - don't use the Macro assign
wizard but but just call a method (the macro) from the button click
event from the form code (as you would in VB6).
If the user has opened more than one file, which have macros of the
same name Excel can get confused.
If you put your macro code in an addin and reference the addin from the
files themselves this may get around your problem. Though I have to
say I've not come across the problem you have described.
Hope you sort it.
Mark
--
Dave Peterson