Possible workaround bases on Application.WindowSelectionChange Event
. Therefore you need to keep the following steps:
1.Create Class module
2.Name your Class module App
3.Add the following code to App Class Module
:
Public WithEvents WRD As Application
Private Sub WRD_WindowSelectionChange(ByVal Sel As Selection)
'here you should place solution from your Document_Open sub
'which defines color based on user name or...
'you could place it somewhere else but pass color value
'here as a parameter
'for test I just assumed that color should be blue
Sel.Font.Color = wdColorBlue
End Sub
4.In standard module add public variable:
Public tmpApp As New App
5.Create Sub in standard module, or add code to your Document_Open Event
, which will initialize our class:
Sub Document_Open_new()
Set tmpApp.WRD = Application
'we need to change selection once to trigger full
'scope of solution
'if we omit the code below new color will not work
'if user add new text at the beginning of the document
'right after it was opened
Dim tmpSel As Range
Set tmpSel = Selection.Range
ActiveDocument.Bookmarks("\EndOfDoc").Select
tmpSel.Select
End Sub
6.Run the above sub once or open document if the code was added to Document_open event
.
---EDIT--- (after some comments from @Sid below)
There are some inconveniences of using proposed solution. However, MOST OF THEM COULD BE SOLVED by adding some If statements
inside WindowSelectionChange event
. Checking for position of Sel range
parameter, text around and others allows to precisely decide whether new color should be applied or not.