excel with vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jakekeke@gmail.com

    #1

    excel with vb.net

    Dear all,

    I would like to use excel and vb.net to create a report(xml) generator,
    however, i wouldnt find any source for making shapes(button,l abel) from
    vb.net to initial excel
    what i want to know is how can i get the actionlistener of a button,
    which the coding is made in VB.Net but the button is added on a
    spreadsheet
    i think i have store the object reference of that button
    but using onAction is not possible since i want control the
    actionlistenre in my Vb.net, is it possible??

    Thank and regards,
    Jake

  • Cor Ligthert

    #2
    Re: excel with vb.net

    Jake,

    In my opinion do you have to decide where your action (your button) is. It
    is either in a windowforms and than you can use VBNet or it is on your
    spreadsheet and than you can use Excel programming.

    Just my opinion.

    Cor


    Comment

    • Carlos J. Quintero [.NET MVP]

      #3
      Re: excel with vb.net

      Hi,

      I don¡¦t know the exact answer to that question, but those kinds of things
      seem a good candidate to use Visual Studio Tools for Office (VSTO). VSTO is
      an add-on for VS.NET 2003 which allows you to build Office solutions using
      ..NET instead of VBA. See:

      http://msdn.microsoft.com/office/understanding/vsto/

      --

      Best regards,

      Carlos J. Quintero

      MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
      You can code, design and document much faster.
      Free resources for add-in developers:
      MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


      <jakekeke@gmail .com> escribio en el mensaje
      news:1116921990 .916662.41610@o 13g2000cwo.goog legroups.com...[color=blue]
      > Dear all,
      >
      > I would like to use excel and vb.net to create a report(xml) generator,
      > however, i wouldnt find any source for making shapes(button,l abel) from
      > vb.net to initial excel
      > what i want to know is how can i get the actionlistener of a button,
      > which the coding is made in VB.Net but the button is added on a
      > spreadsheet
      > i think i have store the object reference of that button
      > but using onAction is not possible since i want control the
      > actionlistenre in my Vb.net, is it possible??
      >
      > Thank and regards,
      > Jake
      >[/color]


      Comment

      • jakekeke@gmail.com

        #4
        Re: excel with vb.net

        hi,

        thx u 2 guys reply
        my code will based on VB.net(VS.net) only
        however, i need generate so buttons on spreadsheet to make it function
        well
        if i use the method .onaction.....i t seem i should assign a marco on
        it....
        doesnt it?
        can i do all my stuff on vb.net only?
        ie, all the action handler can only be found on vb.net

        thx and regard,
        Jake

        Comment

        • jakekeke@gmail.com

          #5
          Re: excel with vb.net

          to explain more clearly
          i post my coding here

          Private Sub ThisWorkbook_Op en() Handles ThisWorkbook.Op en

          ' Visual Basic
          Dim str As String
          str = "About Visual Basic"
          Dim mySheet As Excel.Worksheet
          Dim myRange As Excel.Range

          mySheet = _
          CType(Me.ThisAp plication.Sheet s.Item(1), _
          Excel.Worksheet )

          Dim sel As Excel.Button
          sel = _
          CType(mySheet.B uttons.Add(143. 25, 83.25, 97.5, 27), _
          Excel.Button)
          MsgBox(11)
          MsgBox(sel.Text )
          sel.Text = "test"
          MsgBox(sel.Text )

          'do sth here!!!!

          MsgBox(22)

          CType(mySheet.C ells.Item(2, 2), Excel.Range).Va lue _
          = "Hello From"
          CType(mySheet.C ells.Item(3, 2), Excel.Range).Va lue _
          = "About Visual Basic"
          myRange = mySheet.Range(" B2:B3")
          myRange.Font.Co lorIndex = 3
          myRange.Font.Bo ld = True
          myRange.Font.Si ze = 18
          opened = True
          End Sub

          in the comment "do sth here!!!!"
          can i add some statement to control action of button on the
          spreadsheet??
          just like onAction in macro.......... .

          thx

          Comment

          Working...