View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default User-Specific, Not Document-Specifie

Not quite sure but do you mean, maybe somethinng like this

Sub test2()
' entry point in the addin, eg called by a button

If Not wbOK(True) Then Exit Sub

Range("A1") = Now
End Sub

Function wbOK(Optional bMsg As Boolean) As Boolean
Dim sName As String
Dim wb As Workbook
Const WB_NAME As String = "BOOK" ' specific document name

On Error Resume Next
Set wb = ActiveWorkbook
sName = wb.Name
On Error GoTo errExit

If Left$(UCase(sName), Len(WB_NAME)) = WB_NAME Then
wbOK = True

ElseIf bMsg Then
MsgBox "The addin cannot procees " & sName
End If

errExit:
End Function

Regards,
Peter T



"PeteCresswell" wrote in message
...
Seems pretty clear: .XLAs are not document specific. Instead they're
associated with a UserID.

Apart from setting References, is there any way around this? My
preference would be to make a .XLA associated with a specific document
instead of a user.