+ Reply to Thread
Results 1 to 5 of 5

VBA code to change the application.username and application.userinitials

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2007
    Posts
    71

    VBA code to change the application.username and application.userinitials

    I'm having issues changing the user initials with my vba code. This code works for changing the application.username, and then I would like to change the initials based on cell A41 (it runs a formula based on A40 to get initials based on Last, First).

    EDIT: I have found a way of changing it, but need help with "Find" in VBA, see comment #3 for code.

    cell A41 is
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Thank you!
    Justin
    Last edited by jwlamb; 01-10-2014 at 10:03 PM. Reason: added formula

  2. #2
    Registered User
    Join Date
    08-14-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: VBA code to change the application.username and application.userinitials

    I have found the object for word, and can pull the set initials, but I cannot find a way to change them, other than a pre-defined "ABC".

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-14-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: VBA code to change the application.username and application.userinitials

    I think I got it if anyone can help me converting this
    Please Login or Register  to view this content.
    into VBA code. When I just paste it into the VBA, I get a "Compile error - Sub or Function not defined" and "File" is highlighted yellow.

    Thank you,

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VBA code to change the application.username and application.userinitials

    So the problem is a parsing issue. Give an example of a value and the expected return value from the formula. There are easier ways to parse in VBA versus built-in formulas.

  5. #5
    Registered User
    Join Date
    08-14-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: VBA code to change the application.username and application.userinitials

    I figured it out. The "find" feature does not work in VBA the same as it does in a regular formula. Then I couldn't get the objWord.UserInitials to match the cell value. But what I found is if I change it to a string UCase(Sheets("requirements").Range("A42")) it works fine. Below is my code, I modified it to be cells A1 and A2 on a new worksheet "Username tab" and hid the tab. FYI, I have no idea what parsing is.

    A1 get's it's info from the Application.UserName which is Last, First M.
    A2 is
    Please Login or Register  to view this content.
    The VBA is
    Please Login or Register  to view this content.
    Last edited by jwlamb; 01-10-2014 at 11:28 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Populating application username if next cell is populated- formula
    By KK1234 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-12-2013, 10:46 AM
  2. usage input box and application.username
    By jwongsf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2009, 06:23 PM
  3. Application UserName
    By talytech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2007, 05:06 PM
  4. [SOLVED] [SOLVED] Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen)
    By Paul Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2005, 12:05 PM
  5. Replace application.RTD property by Application.RTDServers collect
    By John.Greenan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2005, 10:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1