Create application to extract data from excel sheet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Huang [MSFT]

    #16
    Re: Create application to extract data from excel sheet

    Hi Philip,

    From your description, I understand that when you input a value in the
    cell(e.g. cell(2,2)), after you press F5 to run the VSTO project in Debug
    mode, you will find that the value in Cell(2,2) is empty.

    If I have any misunderstandin g, please feel free to post here.

    Based on my test, I can not reproduce the problem.

    So far I suggest you create a new VSTO project and input a value in
    Cell(2,2) and then press F5 to run the Project to see if the value in
    cell(2,2)exists .

    Also due to the IDE will try to load many symbols for VSTO projects, after
    you press F5, please wait until the cursor is not busy.

    Best regards,

    Peter Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    Comment

    • Philip Wagenaar

      #17
      Re: Create application to extract data from excel sheet

      Is it possible but that the location where Globals.ThisWor kbook.Save saves
      its file is diffrent from Globals.ThisWor kbook.FullName in Visual Studio
      debug mode?

      The code I am using:

      Private Sub btn_bestellen_C lick(ByVal sender As System.Object, ByVal e As
      System.EventArg s) Handles btn_bestellen.C lick
      Try
      Globals.ThisWor kbook.Save()
      Catch ex As Exception
      MsgBox("Some error message in dutch")
      Exit Sub
      End Try

      Dim connectionStrin g As String = "Provider=Micro soft.Jet.OLEDB. 4.0;"
      & _
      "Data Source=" & Globals.ThisWor kbook.FullName & ";" & _
      "Extended Properties=""Ex cel 8.0;HDR=NO"""

      Dim ExcelConnection As New
      System.Data.Ole Db.OleDbConnect ion(connectionS tring)
      ExcelConnection .Open()
      Dim da As New System.Data.Ole Db.OleDbDataAda pter("Select * from " &
      orderRange, ExcelConnection )
      Dim ds As New DataSet
      da.Fill(ds, "Order")
      ds.WriteXml("c: \test2.xml")


      ExcelConnection .Close()



      End Sub

      ""Peter Huang" [MSFT]" wrote:
      [color=blue]
      > Hi Philip,
      >
      > From your description, I understand that when you input a value in the
      > cell(e.g. cell(2,2)), after you press F5 to run the VSTO project in Debug
      > mode, you will find that the value in Cell(2,2) is empty.
      >
      > If I have any misunderstandin g, please feel free to post here.
      >
      > Based on my test, I can not reproduce the problem.
      >
      > So far I suggest you create a new VSTO project and input a value in
      > Cell(2,2) and then press F5 to run the Project to see if the value in
      > cell(2,2)exists .
      >
      > Also due to the IDE will try to load many symbols for VSTO projects, after
      > you press F5, please wait until the cursor is not busy.
      >
      > Best regards,
      >
      > Peter Huang
      > Microsoft Online Partner Support
      >
      > Get Secure! - www.microsoft.com/security
      > This posting is provided "AS IS" with no warranties, and confers no rights.
      >
      >[/color]

      Comment

      • Peter Huang [MSFT]

        #18
        Re: Create application to extract data from excel sheet

        Hi Philip,

        Based on my test, Globals.ThisWor kbook.Save() will save the change back
        into the original path.
        e.g. C:\workbook.xls

        Then after changed, the Globals.ThisWor kbook.Save() will save the change to
        C:\workbook.xls

        Best regards,

        Peter Huang
        Microsoft Online Partner Support

        Get Secure! - www.microsoft.com/security
        This posting is provided "AS IS" with no warranties, and confers no rights.

        Comment

        Working...