I want to know how to find the name of the current user

I tried the following

Set onamespace = Application.GetNamespace("MAPI")
name = onamespace.CurrentUser

But it pops up a message requesting us to click yes to allow access ... I want to avoid this message ..

Pls give me sample code with a new method or a method to avoid this message