BeforeRemoteChange

Erdrick

New Member
Joined
Jul 5, 2016
Messages
21
Hello,

I am having issues getting the BeforeRemoteChange event to trigger properly. I can not get either the before or after events to trigger. I have the following code that i know partially works, because it is triggered for sheet changes events. This tells me my app is setup properly, but i get nothing when others make changes to the worksheet remotely. Any ideas?

VBA Code:
Option Explicit
Public WithEvents App As Application

Private Sub Workbook_Open()
 Set App = Application
End Sub

Private Sub App_WorkbookBeforeRemoteChange(ByVal Wb As Workbook)
 MsgBox Wb.Name & " is being remotely changed"
End Sub

Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Debug.Print "local change detected"
End Sub

Private Sub App_WorkbookAfterRemoteChange(ByVal Wb As Workbook)
    Debug.Print "After change detected"
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Afaik you can only do this (withevents) in a class module.
Is this a shared workbook?
 
Upvote 0
Consider wether you need the application object, or maybe it makes more sense to use the workbook object.
 
Upvote 0
Huh, you are right. Not sure what I did wrong the first time. It is working like a charm now. Thanks for the push back in the right direction.

ThisWorkbook
VBA Code:
Option Explicit

Dim Obj As New AppClass

Private Sub Workbook_Open()
 Set Obj.App = Application
End Sub

Class: App Class
VBA Code:
Option Explicit

Public WithEvents App As Application

Private Sub App_WorkbookBeforeRemoteChange(ByVal Wb As Workbook)
    Debug.Print "Before change detected"
End Sub

Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Debug.Print "local change detected"
End Sub

Private Sub App_WorkbookAfterRemoteChange(ByVal Wb As Workbook)
    Debug.Print "After change detected"
End Sub
 
Upvote 0
Huh, you are right. Not sure what I did wrong the first time. It is working like a charm now. Thanks for the push back in the right direction.

ThisWorkbook
VBA Code:
Option Explicit

Dim Obj As New AppClass

Private Sub Workbook_Open()
 Set Obj.App = Application
End Sub

Class: App Class
VBA Code:
Option Explicit

Public WithEvents App As Application

Private Sub App_WorkbookBeforeRemoteChange(ByVal Wb As Workbook)
    Debug.Print "Before change detected"
End Sub

Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Debug.Print "local change detected"
End Sub

Private Sub App_WorkbookAfterRemoteChange(ByVal Wb As Workbook)
    Debug.Print "After change detected"
End Sub
Glad I could help ?
 
Upvote 0
It is my understanding that BeforeRemoteChange must be accessed from the application level.
 
Upvote 0
If it works then I guess you are totally right. I can experiment a bit tomorrow and post the results. But as a general rule i decided for myself i will stay away from shared workbooks to the extent possible.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top