Re: problem uninstalling an add-in
- From: "papou" <cpapounospamthanx@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Jan 2008 10:25:07 +0100
Hello
You should consider using the API function GetComputerName instead, it would
prevent you from using a loop.
Place this in the top declaration in your module:
And then amend your code as follows:
Private Sub Workbook_AddinInstall()
Dim sTempString As String, sCompName As String
Dim lBuffer As Long
sTempString = Space(250)
lBuffer = 251
GetComputerName sTempString, lBuffer
sCompName = Split(sTempString, Chr(0))(0)
If Lcase(sCompName) <> "leon1" Then
AddIns("Periodical Table").Installed = False: Exit Sub
End If
End Sub
HTH
Cordially
Pascal
"filo666" <filo666@xxxxxxxxxxxxxxxxxxxxxxxxx> a écrit dans le message de
news: F0ADA6B0-B50D-48C9-B8F6-91B7193ABED6@xxxxxxxxxxxxxxxx
please note that I add the AddIns("Periodical Table").Installed=false
correctly, yesterdays post suggested that I wrot wrongly the command,
however, the command was well written obtaining the same results
How to uninstall the add-in???
"filo666" wrote:
yesterday I asked:
Hi, I'm trying to figure out how to accomplish somehting:
I have an add-in and I would like it to chek the computer's name when
installed, if the computer's name does not match the default registered
computer's name (Leon1 in this case) then the add-in is uninstalled
(uninstall itself).
The code works fine until the AddIns("Periodical Table").Installed=false
is
called:
Private Sub Workbook_AddinInstall()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem")
With Workbooks("periodical Table.xla").Sheets(2)
For Each objComputer In colSettings
If LCase(objComputer.Name) <> "leon1" Then
MsgBox "The program has detected that you coppied the add-in, please
contact
your program provider", vbOKOnly, "Illegal copy detection"
AddIns("Periodical Table").Installed=false
Else: GoTo nx
End If
Next
End With
nx:
End Sub
It does not appear any error, the msgbox works well but it nevers
uninstall
the add-in.
TIA
.
- Follow-Ups:
- Re: problem uninstalling an add-in
- From: papou
- Re: problem uninstalling an add-in
- References:
- RE: problem uninstalling an add-in
- From: filo666
- RE: problem uninstalling an add-in
- Prev by Date: Re: Copy to data*** -Message for Ron De Bruin
- Next by Date: Re: problem uninstalling an add-in
- Previous by thread: RE: problem uninstalling an add-in
- Next by thread: Re: problem uninstalling an add-in
- Index(es):