• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

VB.net Excel Add-in Form dissapears after opening through Excel double click

Hi

I open a form through the Excel double click in my Excel VB.net add-in, but it keeps
jumping behind Excel. My code follows. What can I do to prevent this?

    Private Sub Application_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Microsoft.Office.Interop.Excel.Range, ByRef Cancel As Boolean) Handles Application.SheetBeforeDoubleClick
        Try
            If Globals.Ribbons.Ribbon1.ToggleButton_OpenElementPanes.Checked = True Then

                Dim Form_DoubleClickMenu As New frmDoubleClickMenu
                Form_DoubleClickMenu.Show()
                Form_DoubleClickMenu.BringToFront()
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
0
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
CodeCruiserCommented:
Can you not use ShowDialog?
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
That worked very well. Thanks very much!
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now