XLA: User-Specific, Not Document-Specifie

  • Thread starter Thread starter PeteCresswell
  • Start date Start date
P

PeteCresswell

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top