none
How to reference a Excel cell from a VSTO form? RRS feed

  • Question

  • Hi,

    In VSTO for Excel, and for a document-level project, if I put a botton in a form, how can I reference workbook and worksheet content, say, a range or cell, from the event handler of that button on the form?

    If I drag a button directly into some place in worksheet,

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.Cells(3, 3).value = "Browser"
        End Sub

    I have found that Me is no longer useful. What kind of reference do I have to add in order to access workbook/worksheet/range?

    Bob

    Wednesday, February 22, 2012 5:26 PM

Answers

  • Hi Bob,

    Thanks for posting in the MSDN Forum.

    Would you please clarify where your button is? Is it in a window form application, or custom task pen of the Excel application?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Sun Saturday, March 3, 2012 5:55 PM
    Friday, February 24, 2012 7:13 AM
    Moderator

All replies

  • Hi Bob,

    Thanks for posting in the MSDN Forum.

    Would you please clarify where your button is? Is it in a window form application, or custom task pen of the Excel application?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Sun Saturday, March 3, 2012 5:55 PM
    Friday, February 24, 2012 7:13 AM
    Moderator
  • Tom,

    It is now solved. Thanks.

    Bob



    • Edited by Bob Sun Saturday, March 3, 2012 5:59 PM
    Saturday, March 3, 2012 1:52 PM