ajwillshire
okunmadı,18 Tem 2011 11:11:5918.07.2011Yazara yanıt vermek için oturum açın
Yönlendirmek için oturum açın
Bu gruptaki iletileri silme izniniz yok
İletiyi bildirmek için oturum açın
Bu grupta e-posta adresleri anonim veya orijinal mesajı görmek için üye e-posta adreslerini görüntüleme iznine ihtiyacınız var
alıcı Excel-DNA
Hi,
I know this has come up in a few other threads already (sometimes
almost as a side topic) but I've had trouble getting it to work with
my application and I'm wondering if I'm doing something wrong.
When my add-in is loaded I've got it to read a text file (as a
licence), decode it, check it's valid and set a global constant to
True or False.
If it's false I want it to show a message and then effectively unload
itself so that the functions are not available to be used.
Here's my code (VB) using what I've picked up from other threads:
---------------------------------------------------------------------------------------------------------------------------
Public Sub AutoOpen() Implements
ExcelDna.Integration.IExcelAddIn.AutoOpen
If LicenceBoolean Then
'MsgBox("Hello - This is correctly licenced", vbOK)
Else
MsgBox("This add-in is not licenced - please contact XXX
for more information.", vbOK)
RemoveMe()
End If
End Sub
Public Sub AutoClose() Implements
ExcelDna.Integration.IExcelAddIn.AutoClose
MsgBox("Goodbye World", vbOK)
End Sub
Private Sub RemoveMe()
Dim myName As String =
DirectCast(XlCall.Excel(XlCall.xlGetName), String)
Dim removeId As Object = XlCall.Excel(XlCall.xlfRegister,
myName, "xlAutoRemove", "I", ExcelMissing.Value, ExcelMissing.Value,
2)
Dim removeResult As Object = XlCall.Excel(XlCall.xlfCall,
removeId)
Dim removeUnregister As Object =
XlCall.Excel(XlCall.xlfUnregister, removeId)
End Sub
---------------------------------------------------------------------------------------------------------------------------
Thanks,
Andrew