Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VSTO Actions Pane Question

Status
Not open for further replies.

sabloomer

Technical User
Aug 8, 2003
153
US
I have an Excel 2007 Add-In that displays an Actions Pane. The pane is pretty simple, two text boxes and two buttons. When I click one button I can insert the text from the boxes into the sheet. I can click the other button I can can take data out of the cells and insert it into the text boxes.

Here is my problem, when I update the my cells I want the Actions Pane to update automatically. I can not find any way from within VBA (Excel) to reference the text boxes on the pane. Is that even possible? The best I can do is set a timer on the pane to update every X seconds.

Thanks,

sabloomer
 
This is my first Excel 2007 Add-in and I am just trying to prove functionality, it doesn't do much. Under the project type Visual Basic I selected "Office" and then "2007 Add-Ins".

I have the following code in the ThisAddIn.vb section...

Public Class ThisAddIn

Private ctpCard As Microsoft.Office.Tools.CustomTaskPane

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
' Start of VSTO generated code

Me.Application = CType(Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(GetType(Excel.Application), Me.Application), Excel.Application)

' End of VSTO generated code


ctpCard = Me.CustomTaskPanes.Add(New ScoreCard(), "ABP Score Card")
ctpCard.Visible = True

Globals.ThisAddIn.Application.Range("A10").FormulaR1C1 = "One"
Globals.ThisAddIn.Application.Range("A11").FormulaR1C1 = "Two"


End Sub


Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
Me.CustomTaskPanes.Remove(ctpCard)
End Sub

End Class


And the following code in the User Control section...


Public Class ScoreCard
Private Sub btn_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Push.Click
Globals.ThisAddIn.Application.Range("A2").FormulaR1C1 = "One"
Globals.ThisAddIn.Application.Range("A3").FormulaR1C1 = "Two"
Globals.ThisAddIn.Application.Range("B2").FormulaR1C1 = Me.txt_One.Text
Globals.ThisAddIn.Application.Range("B3").FormulaR1C1 = Me.txt_Two.Tex
End Sub

Private Sub btn_Pull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Pull.Click
Me.txt_One.Text = Globals.ThisAddIn.Application.Range("B10").FormulaR1C1
Me.txt_Two.Text = Globals.ThisAddIn.Application.Range("B11").FormulaR1C1

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.txt_One.Text = Globals.ThisAddIn.Application.Range("B10").FormulaR1C1
Me.txt_Two.Text = Globals.ThisAddIn.Application.Range("B11").FormulaR1C1
End Sub
End Class
 
CaptainD,

I found my answer, I needed to add the code in the "Application_SheetChange" section of VSTO. This brings another problem, but I will open a new thread.

Thank You,

sabloomer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top