ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XLA: User-Specific, Not Document-Specifie (https://www.excelbanter.com/excel-programming/412047-xla-user-specific-not-document-specifie.html)

PeteCresswell[_2_]

XLA: User-Specific, Not Document-Specifie
 
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.

Peter T

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.





All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com