M
Matthew Wieder
I have some VB code that automates Excel (2002/2003) and places an
ActiveX button on the spreadsheet and changes the button caption. All
this works as it is supposed to, however, the moment the application
terminates, the caption on the button reverts back to the default
caption! How can I make the caption permanent?
Imports Excel = Microsoft.Office.Interop.Excel
Sub Main()
Dim oWS As Excel.Worksheet
Dim oExcel As New Excel.Application
Dim oOleObj As Object
Dim oBtn As Object
oExcel = GetObject(, "Excel.Application")
oWS = oExcel.ActiveSheet()
oOleObj =
oWS.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False,
DisplayAsIcon:=False, Left:=60.75, Top:=30.75, Width:=90.75,
Height:=24).Object()
oBtn = oOleObj.Object
oBtn.Caption = "My Caption"
End Sub
ActiveX button on the spreadsheet and changes the button caption. All
this works as it is supposed to, however, the moment the application
terminates, the caption on the button reverts back to the default
caption! How can I make the caption permanent?
Imports Excel = Microsoft.Office.Interop.Excel
Sub Main()
Dim oWS As Excel.Worksheet
Dim oExcel As New Excel.Application
Dim oOleObj As Object
Dim oBtn As Object
oExcel = GetObject(, "Excel.Application")
oWS = oExcel.ActiveSheet()
oOleObj =
oWS.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False,
DisplayAsIcon:=False, Left:=60.75, Top:=30.75, Width:=90.75,
Height:=24).Object()
oBtn = oOleObj.Object
oBtn.Caption = "My Caption"
End Sub