D
Daniel McCarty
I have a quote template that pulls in parts and descriptions from a
database and turns them all into a nice quote, which is also merged and
linked with GoldMine. It has a custom toolbar and one the buttons on
the toolbar allows the user to pick a salesman and automatically
inserts the salesman's name and title, signature and next quote number.
After the user picks a salesman I'd like to disable the Select Salesman
toolbar button, since it will screw up the quote if they do it more
than once. So I save whether a salesman was picked as a custom
property in the quote, a la
Set docp = doc.CustomDocumentProperties
With docp.Add("qtFSalesman", False, msoPropertyTypeBoolean, True)
' We don't really need to do anything here, but we could...
End With
' Once the salesman is selected don't allow another selection.
CommandBars("Quotes").Controls(1).Enabled = False
Later, if the document is opened, code in Document_Open() does pretty
much the same thing:
' Read the custom document property "qtFSalesman" and allow or
' disallow the salesman selection based on the property value.
fSalesman = ActiveDocument.CustomDocumentProperties("qtFSalesman")
ActiveDocument.CommandBars("Quotes").Controls(1).Enabled = _
Not fSalesman
My problem is that users don't get the custom toolbar just by creating
a new document based on the template. So they go to Tools...Add-Ins
and explicitly add .dot template as a global template. When the code
runs it disables the toolbar in the _template_, not in the new
document.
How can I only disable the Salesman button on the toolbar of the new
document?
Thanks in advance,
Dan.
database and turns them all into a nice quote, which is also merged and
linked with GoldMine. It has a custom toolbar and one the buttons on
the toolbar allows the user to pick a salesman and automatically
inserts the salesman's name and title, signature and next quote number.
After the user picks a salesman I'd like to disable the Select Salesman
toolbar button, since it will screw up the quote if they do it more
than once. So I save whether a salesman was picked as a custom
property in the quote, a la
Set docp = doc.CustomDocumentProperties
With docp.Add("qtFSalesman", False, msoPropertyTypeBoolean, True)
' We don't really need to do anything here, but we could...
End With
' Once the salesman is selected don't allow another selection.
CommandBars("Quotes").Controls(1).Enabled = False
Later, if the document is opened, code in Document_Open() does pretty
much the same thing:
' Read the custom document property "qtFSalesman" and allow or
' disallow the salesman selection based on the property value.
fSalesman = ActiveDocument.CustomDocumentProperties("qtFSalesman")
ActiveDocument.CommandBars("Quotes").Controls(1).Enabled = _
Not fSalesman
My problem is that users don't get the custom toolbar just by creating
a new document based on the template. So they go to Tools...Add-Ins
and explicitly add .dot template as a global template. When the code
runs it disables the toolbar in the _template_, not in the new
document.
How can I only disable the Salesman button on the toolbar of the new
document?
Thanks in advance,
Dan.