S
sajin
Hi,
I developed an application which creates some addin in office (
word,excel and powerpoint) , i created a console application which wil
be called during uninstallation of the addin , but the addin toolbar
never goes , where am i doing wrong
'code is as follows ( VS 2005 , VB.Net)
Imports System.IO
Module DeleteToolBar
Private WordAppClass As New Word.ApplicationClass
Private ExcelAppClass As New Excel.ApplicationClass
Private PPTAppClass As New PowerPoint.ApplicationClass
Sub Main()
Try
'The MyAddinBar toolbar has to be removed from Word while
uninstalling the My.0
Dim oMissing As Object
Dim cmdBar As Office.CommandBar
Dim cmdCntrl As Office.CommandBarControl
Dim oSaveChanges As Object
Dim oOriginalFormat As Object
oMissing = System.Reflection.Missing.Value
oSaveChanges = True
oOriginalFormat = Nothing
For Each cmdBar In WordAppClass.CommandBars
' If the commandbar name is "MyAddinBar" , then delete
the commandbar from the word applicaton
If cmdBar.Name = "MyAddinBar Toolbar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
'For Each cmdCntrl In cmdBar.Controls
' cmdCntrl.Delete()
'Next
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
WordAppClass.Quit(oMissing, oMissing, oMissing)
System.Threading.Thread.Sleep(5000)
For Each cmdBar In ExcelAppClass.CommandBars
' then delete the commandbar from the applicaton
If cmdBar.Name = "MyAddinBar Toolbar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
' After the modification, the application has to save the
changes
ExcelAppClass.Quit()
For Each cmdBar In PPTAppClass.CommandBars
' then delete the commandbar from the applicaton
If cmdBar.Name.Equals("MyAddinBar Toolbar") Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
' After the modification, the application has to save the
changes
PPTAppClass.Quit()
Catch ex As Exception
End Try
End Sub
End Module
Please help me.
Thanks in advance
Sajin
I developed an application which creates some addin in office (
word,excel and powerpoint) , i created a console application which wil
be called during uninstallation of the addin , but the addin toolbar
never goes , where am i doing wrong
'code is as follows ( VS 2005 , VB.Net)
Imports System.IO
Module DeleteToolBar
Private WordAppClass As New Word.ApplicationClass
Private ExcelAppClass As New Excel.ApplicationClass
Private PPTAppClass As New PowerPoint.ApplicationClass
Sub Main()
Try
'The MyAddinBar toolbar has to be removed from Word while
uninstalling the My.0
Dim oMissing As Object
Dim cmdBar As Office.CommandBar
Dim cmdCntrl As Office.CommandBarControl
Dim oSaveChanges As Object
Dim oOriginalFormat As Object
oMissing = System.Reflection.Missing.Value
oSaveChanges = True
oOriginalFormat = Nothing
For Each cmdBar In WordAppClass.CommandBars
' If the commandbar name is "MyAddinBar" , then delete
the commandbar from the word applicaton
If cmdBar.Name = "MyAddinBar Toolbar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
'For Each cmdCntrl In cmdBar.Controls
' cmdCntrl.Delete()
'Next
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
WordAppClass.Quit(oMissing, oMissing, oMissing)
System.Threading.Thread.Sleep(5000)
For Each cmdBar In ExcelAppClass.CommandBars
' then delete the commandbar from the applicaton
If cmdBar.Name = "MyAddinBar Toolbar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
' After the modification, the application has to save the
changes
ExcelAppClass.Quit()
For Each cmdBar In PPTAppClass.CommandBars
' then delete the commandbar from the applicaton
If cmdBar.Name.Equals("MyAddinBar Toolbar") Then
cmdBar.Delete()
End If
If cmdBar.Name = "MyAddinBar" Then
cmdBar.Delete()
End If
If cmdBar.Name = "My Calculate" Then
cmdBar.Delete()
End If
If cmdBar.Name = "Copy Cells" Then
cmdBar.Delete()
End If
Next
' After the modification, the application has to save the
changes
PPTAppClass.Quit()
Catch ex As Exception
End Try
End Sub
End Module
Please help me.
Thanks in advance
Sajin