Issue Changing username using vba

I am using a short piece of code that allows users to reset their Word username and initials to the company name for consistency when using Track Changes.

If Application.UserName <> "Company Name" Then
    Application.UserName = "Company Name"
    Application.UserInitials = "CN"
End If

However whenever the code runs to change the username, a warning is displayed "The setting could not be created" and the code is paused, when users click OK in the warning dialog, the code continues and the username is changed.

How can I either disable the warning or prevent it being displayed?

I have tried using Application.DisplayAlerts = wdAlertsNone before Application.UserName = "Company Name" but this doesn't work.


May 22nd, 2015 11:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics