Click here to Skip to main content
16,017,373 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI,

I am Working on SCADA project in which I am writing real time data to excel worksheet. Now I want to apply a check on data that if worksheet is updating continuously or not if not then I will restart my windows form Application. I try following code but it doesn't work.

VB
Private EventDel_CellsChange As Excel.DocEvents_ChangeEventHandler

        Public Sub UseDelegate()


            'Get references to the the worksheet.
            xlBook = excelWB
            xlSheet1 = xlBook.Worksheets(2)
            CType(xlSheet1, Excel._Worksheet).Activate()
            'Add an event handler for the Change event for Worksheet
            'object.
            EventDel_CellsChange = New Excel.DocEvents_ChangeEventHandler( _
                  AddressOf CellsChange)
            AddHandler xlSheet1.Change, EventDel_CellsChange

            'Make Excel visible and give the user control.
            xlApp.Visible = True
            xlApp.UserControl = True
        End Sub

        Private Sub CellsChange(ByVal Target As Excel.Range)
            'This is called when a cell or cells on a worksheet are changed.
            MsgBox("Restrating Of Application Required")
        End Sub


Any Help Please ................ thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900