How to tell if Excel Application is in cell-edit mode?

后端 未结 3 1434
悲哀的现实
悲哀的现实 2020-12-18 12:35

I\'m writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range

3条回答
  •  借酒劲吻你
    2020-12-18 13:25

    Try this function:

        Function IsInEditMode(ByRef exapp As Excel.Application) As Boolean
            If exapp.Interactive = False Then
                Return False
            Else
                Try
                    exapp.Interactive = False
                    exapp.Interactive = True
    
                    Return False
                Catch
                    Return True
                End Try
            End If
        End Function
    

提交回复
热议问题