C# Snippets


Event_App_NewWorkbook

Public Sub AppEvents_NewWorkbook(ByVal Wb As Excel.Workbook) _
Handles AppEvents2.NewWorkbook

WbkEvents = CType(gApplicationExcel.ActiveWorkbook, Excel.Workbook)

If mbFireEvents = True Then
RaiseEvent AppEventsNewWorkbook_Event()
End If
End Sub

Event_App_SheetBeforeRightClick

Public Sub AppEvents_SheetBeforeRightClick(ByVal Sh As Object, _
ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) _
Handles AppEvents.SheetBeforeRightClick

If mbFireEvents = True Then
RaiseEvent AppEventsSheetBeforeRightClick_Event(Sh, Target, Cancel)
End If
End Sub

Event_App_SheetDeactivate

Public Sub AppEvents_SheetDeactivate(ByVal Sh As Object) _
Handles AppEvents.SheetDeactivate

If mbFireEvents = True Then
RaiseEvent AppEventsSheetDeactivate_Event(Sh)
End If
End Sub

Event_App_WindowDeactivate

Public Sub AppEvents_WindowDeactivate(ByVal Wb As Excel.Workbook, _
ByVal Wn As Excel.Window) _
Handles AppEvents.WindowDeactivate

If mbFireEvents = True Then
RaiseEvent AppEventsWindowDeactivate_Event(Wb, Wn)
End If
End Sub

Event_App_WindowResize

Public Sub AppEvents_WindowResize(ByVal Wb As Excel.Workbook, _
ByVal Wn As Excel.Window) _
Handles AppEvents.WindowResize

If mbFireEvents = True Then
RaiseEvent AppEventsWindowResize_Event(Wb, Wn)
End If
End Sub

Event_App_WorkbookAddinInstall

Public Sub AppEvents_WorkbookAddinInstall(ByVal Wb As Excel.Workbook) _
Handles AppEvents.WorkbookAddinInstall

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookAddinInstall_Event(Wb)
End If
End Sub

Event_App_WorkbookAddinUninstall

Public Sub AppEvents_WorkbookAddinUninstall(ByVal Wb As Excel.Workbook) _
Handles AppEvents.WorkbookAddinUninstall

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookAddinUninstall_Event(Wb)
End If
End Sub

Event_App_WorkbookBeforeClose

Public Sub AppEvents_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, _
ByRef Cancel As Boolean) _
Handles AppEvents.WorkbookBeforeClose

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookBeforeClose_Event(Wb, Cancel)
End If
End Sub

Event_App_WorkbookBeforePrint

Public Sub AppEvents_WorkbookBeforePrint(ByVal Wb As Excel.Workbook, _
ByRef Cancel As Boolean) _
Handles AppEvents.WorkbookBeforePrint

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookBeforePrint_Event(Wb, Cancel)
End If
End Sub

Event_App_WorkbookBeforeSave

Public Sub AppEvents_WorkbookBeforeSave(ByVal Wb As Excel.Workbook, _
ByVal SaveAsUI As Boolean, _
ByRef Cancel As Boolean) _
Handles AppEvents.WorkbookBeforeSave

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookBeforeSave_Event(Wb, SaveAsUI, Cancel)
End If
End Sub

Event_App_WorkbookDeactivate

Public Sub AppEvents_WorkbookDeactivate(ByVal Wb As Excel.Workbook) _
Handles AppEvents.WorkbookDeactivate

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookDeactivate_Event(Wb)
End If
End Sub

Event_App_WorkbookNewSheet

Public Sub AppEvents_WorkbookNewSheet(ByVal Wb As Excel.Workbook, _
ByVal Sh As Object) _
Handles AppEvents.WorkbookNewSheet

'chart sheets ??
WshEvents = CType(gApplicationExcel.ActiveSheet, Excel.Worksheet)

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookNewSheet_Event(Wb, Sh)
End If
End Sub

Event_App_WorkbookOpen

Public Sub AppEvents_WorkbookOpen(ByVal Wb As Excel.Workbook) _
Handles AppEvents.WorkbookOpen

WbkEvents = CType(gApplicationExcel.ActiveWorkbook, Excel.Workbook)

'chart sheets ??
WshEvents = CType(gApplicationExcel.ActiveSheet, Excel.Worksheet)

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookOpen_Event(Wb)
End If
End Sub

Event_App_WorkbookPivotTableCloseConnection

Public Sub AppEvents_WorkbookPivotTableCloseConnection(ByVal Wb As Excel.Workbook, _
ByVal Target As Excel.PivotTable) _
Handles AppEvents.WorkbookPivotTableCloseConnection

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookPivotTableCloseConnection_Event(Wb, Target)
End If
End Sub

Event_App_WorkbookPivotTableOpenConnection

Public Sub AppEvents_WorkbookPivotTableOpenConnection(ByVal Wb As Excel.Workbook, _
ByVal Target As Excel.PivotTable) _
Handles AppEvents.WorkbookPivotTableOpenConnection

If mbFireEvents = True Then
RaiseEvent AppEventsWorkbookPivotTableOpenConnection_Event(Wb, Target)
End If
End Sub

Workbook_Activate

Private Sub WbkEvents_WorkbookActivate() Handles WbkEvents2.Activate

If mbFireEvents = True Then
RaiseEvent WbkEventsActivate_Event()
End If
End Sub

Workbook_AddinInstall

Private Sub WbkEvents_AddinInstall() Handles WbkEvents.AddinInstall

If mbFireEvents = True Then
RaiseEvent WbkEventsAddinInstall_Event()
End If
End Sub

Workbook_AddinUninstall

Private Sub WbkEvents_AddinUninstall() Handles WbkEvents.AddinUninstall

If mbFireEvents = True Then
RaiseEvent WbkEventsAddinUninstall_Event()
End If
End Sub

Workbook_BeforeClose

Private Sub WbkEvents_BeforeClose(ByRef Cancel As Boolean) _
Handles WbkEvents.BeforeClose

If mbFireEvents = True Then
RaiseEvent WbkEventsBeforeClose_Event(Cancel)
End If
End Sub

Workbook_BeforePrint

Private Sub WbkEvents_BeforePrint(ByRef Cancel As Boolean) _
Handles WbkEvents.BeforePrint

If mbFireEvents = True Then
RaiseEvent WbkEventsBeforePrint_Event(Cancel)
End If
End Sub

Workbook_BeforeSave

Private Sub WbkEvents_BeforeSave(ByVal SaveAsUI As Boolean, _
ByRef Cancel As Boolean) _
Handles WbkEvents.BeforeSave

If mbFireEvents = True Then
RaiseEvent WbkEventsBeforeSave_Event(SaveAsUI, Cancel)
End If
End Sub

Workbook_Deactivate

Private Sub WbkEvents_Deactivate() Handles WbkEvents.Deactivate

If mbFireEvents = True Then
RaiseEvent WbkEventsDeactivate_Event()
End If
End Sub

Workbook_NewSheet

Private Sub WbkEvents_NewSheet(ByVal Sh As Object) _
Handles WbkEvents.NewSheet

If mbFireEvents = True Then
RaiseEvent WbkEventsNewSheet_Event(Sh)
End If
End Sub

Workbook_Open

Private Sub WbkEvents_Open() Handles WbkEvents.Open

If mbFireEvents = True Then
RaiseEvent WbkEventsOpen_Event()
End If
End Sub

Workbook_PivotTableCloseConnection

Private Sub WbkEvents_PivotTableCloseConnection(ByVal Target As Excel.PivotTable) _
Handles WbkEvents.PivotTableCloseConnection

If mbFireEvents = True Then
RaiseEvent WbkEventsPivotTableCloseConnection_Event(Target)
End If
End Sub

Workbook_PivotTableOpenConnection

Private Sub WbkEvents_PivotTableOpenConnection(ByVal Target As Excel.PivotTable) _
Handles WbkEvents.PivotTableOpenConnection

If mbFireEvents = True Then
RaiseEvent WbkEventsPivotTableOpenConnection_Event(Target)
End If
End Sub

Workbook_SheetActivate

Private Sub WbkEvents_SheetActivate(ByVal Sh As Object) _
Handles WbkEvents.SheetActivate

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetActivate_Event(Sh)
End If
End Sub

Workbook_SheetBeforeDoubleClick

Private Sub WbkEvents_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) _
Handles WbkEvents.SheetBeforeDoubleClick

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetBeforeDoubleClick_Event(Sh, Target, Cancel)
End If
End Sub

Workbook_SheetCalculate

Private Sub WbkEvents_SheetCalculate(ByVal Sh As Object) _
Handles WbkEvents.SheetCalculate

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetCalculate_Event(Sh)
End If
End Sub

Workbook_SheetChange

Private Sub WbkEvents_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range) _
Handles WbkEvents.SheetChange

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetChange_Event(Sh, Target)
End If
End Sub

Workbook_SheetFollowHyperlink

Private Sub WbkEvents_SheetFollowHyperlink(ByVal Sh As Object, _
ByVal Target As Excel.Hyperlink) _
Handles WbkEvents.SheetFollowHyperlink

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetFollowHyperlink_Event(Sh, Target)
End If
End Sub

Workbook_SheetPivotTableUpdate

Private Sub WbkEvents_SheetPivotTableUpdate(ByVal Sh As Object, _
ByVal Target As Excel.PivotTable) _
Handles WbkEvents.SheetPivotTableUpdate

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetPivotTableUpdate_Event(Sh, Target)
End If
End Sub

Workbook_SheetSelectionChange

Private Sub WbkEvents_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Excel.Range) _
Handles WbkEvents.SheetSelectionChange

If mbFireEvents = True Then
RaiseEvent WbkEventsSheetSelectionChange_Event(Sh, Target)
End If
End Sub

Workbook_WindowActivate

Private Sub WbkEvents_WindowActivate(ByVal Wn As Excel.Window) Handles _
WbkEvents.WindowActivate

If mbFireEvents = True Then
RaiseEvent WbkEventsWindowActivate_Event(Wn)
End If
End Sub

Worksheet_Activate

Public Sub WshEvents_Activate() Handles WshEvents2.Activate

If mbFireEvents = True Then
RaiseEvent WshEventsActivate_Event()
End If
End Sub

Worksheet_BeforeDoubleClick

Public Sub WshEvents_BeforeDoubleClick(ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) _
Handles WshEvents.BeforeDoubleClick

If mbFireEvents = True Then
RaiseEvent WshEventsBeforeDoubleClick_Event(Target, Cancel)
End If
End Sub

Worksheet_BeforeRightClick

Public Sub WshEvents_BeforeRightClick(ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) _
Handles WshEvents.BeforeRightClick

If mbFireEvents = True Then
RaiseEvent WshEventsBeforeRightClick_Event(Target, Cancel)
End If
End Sub

Worksheet_Calculate

Private Sub WshEvents_Calculate() Handles WshEvents2.Calculate

If mbFireEvents = True Then
RaiseEvent WshEventsCalculate_Event()
End If
End Sub

Worksheet_Change

Public Sub WshEvents_Change(ByVal Target As Excel.Range) _
Handles WshEvents.Change

If mbFireEvents = True Then
RaiseEvent WshEventsChange_Event(Target)
End If
End Sub

Worksheet_Deactivate

Public Sub WshEvents_Deactivate() Handles WshEvents.Deactivate

If mbFireEvents = True Then
RaiseEvent WshEventsDeactivate_Event()
End If
End Sub

Worksheet_FollowHyperlink

Public Sub WshEvents_FollowHyperlink(ByVal Target As Excel.Hyperlink) _
Handles WshEvents.FollowHyperlink

If mbFireEvents = True Then
RaiseEvent WshEventsFollowHyperlink_Event(Target)
End If
End Sub

Worksheet_PivotTableUpdate

Public Sub WshEvents_PivotTableUpdate(ByVal Target As Excel.PivotTable) _
Handles WshEvents.PivotTableUpdate

If mbFireEvents = True Then
RaiseEvent WshEventsPivotTableUpdate_Event(Target)
End If
End Sub

Worksheet_SelectionChange

Public Sub WshEvents_SelectionChange(ByVal Target As Excel.Range) _
Handles WshEvents.SelectionChange

If mbFireEvents = True Then
RaiseEvent WshEventsSelectionChange_Event(Target)
End If
End Sub

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top