locked
embed exeel to vb net forms RRS feed

  • Question

  • when i embed excel 2016 to vb net form after typing 2 columns it stop working and restart the excel (its work in old version of excel).
    Thursday, November 10, 2016 6:58 AM

All replies

  • Hi Shachaf,

    >> when i embed excel 2016 to vb net form after typing 2 columns it stop working and restart the excel (its work in old version of excel).

    Could you share us how you embed Excel to vb.net forms? A simple project which could reproduce your issue would be much helpful.

    I suggest you try methods from below link to check whether this issue still exist.

    # Open Excel workbooks in VB.NET Solutions

    https://xldennis.wordpress.com/2007/11/16/open-excel-workbooks-in-vbnet-solutions/

    Best Regards,

    Edward

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites;
    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 16, 2016 6:03 AM
  • thank for your answer

    this is my code

    its works in old version of excel

           Dim Exl As Object = CreateObject("Excel.Application")
            Dim Bok As Object
            Dim Shet As Object
            SetParent(Exl.Hwnd, PanExl.Handle)
            Exl.WindowState = -4143
            Bok = Exl.Workbooks.Open(XlsFile)
            Shet = Exl.Workbooks(1).Sheets(1)

    Wednesday, November 16, 2016 7:36 AM
  • Hi Shachaf,

    Thanks for more information, but it seems it is not complete. There is no definition for SetParent and PanExl, I am not able to make a test. Could you share us the definition? A simple solution project would be much helpful.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 16, 2016 7:42 AM
  • this is the new code

        Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer

        Sub PutXlsObject()
            Dim Exl As Object = CreateObject("Excel.Application")
            Dim Bok As Object
            Dim Shet As Object
            SetParent(Exl.Hwnd, Me.Handle)
            Exl.visible = True
            Exl.WindowState = -4143 'maximze window
            Bok = Exl.Workbooks.Open(XlsFile)
            Shet = Exl.Workbooks(1).Sheets(1)
        End Sub

    thank again

    Wednesday, November 16, 2016 10:26 AM
  • Hi Shachaf,

    Thanks for detailed information. It seems I could reproduce your issue randomly.

    I suggest you try below code.

       Private Sub EmbedExcel_Click(sender As Object, e As EventArgs) Handles EmbedExcel.Click
            Dim Exl As Object = CreateObject("Excel.Application")
            Dim tasks As New List(Of Task)
            tasks.Add(Task.Factory.StartNew(Sub()
    
                                                Dim Bok As Object
                                                Dim Shet As Object
    
                                                Exl.visible = True
                                                Exl.WindowState = -4143 'maximze window
                                                Bok = Exl.Workbooks.Open("C:\Users\xx\Desktop\Test.xlsx")
                                                Shet = Exl.Workbooks(1).Sheets(1)
                                            End Sub
             ))
            Task.WaitAll(tasks.ToArray())
            SetParent(Exl.Hwnd, Me.Handle)
        End Sub
        Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer
    

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 17, 2016 6:46 AM
  • <input class="jfk-button jfk-button-action" id="gt-submit" style="border-radius:2px;font-size:11px;font-weight:bold;white-space:nowrap;margin:0px;height:27px;line-height:27px;min-width:54px;outline:0px;padding:0px 8px;box-shadow:none;background-color:#4d90fe;background-image:-webkit-linear-gradient(top, rgb(77, 144, 254), rgb(71, 135, 237));border-width:1px;border-style:solid;border-color:#3079ed;color:#ffffff;box-sizing:content-box;font-family:inherit;-webkit-appearance:none;" tabindex="0" type="submit" value="תרגם" />
    <textarea autocapitalize="off" autocomplete="off" autocorrect="off" class="goog-textarea" dir="rtl" id="source" name="text" spellcheck="false" style="background-color:rgba(255, 255, 255, 0);border-width:initial;border-style:none;border-color:initial;resize:none;display:block;box-sizing:border-box;color:#222222;font-family:arial, sans-serif;font-size:16px;width:634px;padding:8px 8px 32px 20px;margin:0px;height:105px;outline:none;overflow-y:hidden;overflow-x:auto;" tabindex="0" wrap="SOFT"></textarea>
    <textarea autocapitalize="off" autocomplete="off" autocorrect="off" class="goog-textarea short_text" dir="rtl" disabled="disabled" id="source-is" name="text-is" spellcheck="false" style="background-color:rgba(255, 255, 255, 0);border-width:initial;border-style:none;border-color:initial;resize:none;display:block;box-sizing:border-box;color:silver;font-family:arial, sans-serif;font-size:24px;width:634px;padding:8px 8px 32px 20px;margin:0px;height:68px;outline:none;overflow-y:hidden;overflow-x:auto;" wrap="SOFT"></textarea>
    I tried it on two different computers
    Same problem only in Office 2016
    Sunday, November 20, 2016 6:32 AM
  • I tried it on two different computers

    Same problem only in Office 2016

    Sunday, November 20, 2016 6:33 AM
  • Hi Shachaf,

    Thank you for posting in the MSDN Forum. I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated. Sorry for any inconvenience and have a nice day!

    In addition, if this is an urgent issue, I will suggest you contacting the Microsoft professional support so that our engineers can work closely with you to troubleshoot this issue.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 21, 2016 7:23 AM
  • Well it takes a long time
    And my client despaired and gave up on Office 2016
    Thanks anyway
    Monday, December 12, 2016 6:09 AM