Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default problem uninstalling an add-in

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").Install=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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default problem uninstalling an add-in

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default problem uninstalling an add-in

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" a écrit dans le message de
news: ...
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default problem uninstalling an add-in

Oops, sorry, forgot to paste the declaration part, so here it is:

Private Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long

Cordially
Pascal

"papou" a écrit dans le message
de news: ...
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" a écrit dans le message de
news:
...
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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
uninstalling an add in Simon Shaw Excel Programming 3 May 23rd 07 08:18 AM
Problem with Interop.Excel after uninstalling Office 2007 and installing Office 2003 Bill F[_2_] Excel Programming 2 May 2nd 07 02:52 PM
Problem when uninstalling an Add-in [email protected] Excel Programming 1 June 23rd 06 12:30 PM
Problem uninstalling an Add-in Rohit Excel Discussion (Misc queries) 1 June 23rd 06 08:33 AM
Uninstalling an add-in Francisco José Tornay Mejías Excel Programming 0 January 21st 04 12:24 PM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"