Home > OS >  I have created EXCEL VSTO template with 2016 excel . I need to know how could I get UserName and Pas
I have created EXCEL VSTO template with 2016 excel . I need to know how could I get UserName and Pas

Time:12-09

I have created Excel 2016 VSTO template. Open Visual studio and select the EXCEL VSTO TEMPLATE

Then I select the .xltx template Select the .xltx Image

The project is created in the specified location with xltx Template. VSTO excel template Project location

Now if I open the template from the project location and go to the option. you will see in the UserName place its getting the Default machine UserName and its being Retrieved in the code. But I don't want it. Excel option General

Now we will see that there is one more User is there that is logged in User. Logged In User need to retrieved in code

The code I am using to Retrieve the Logged In User. Code for retrieving the logged in User

But in this code I am getting the user from Excel General Option area but I want it from the Logged In Area.

Please tell me how to do it.

Thanks.

CodePudding user response:

You can use the Environment.UserName to get the user name of the current user.

I don't believe you can get the password.

CodePudding user response:

The Excel object model (nor VSTO) doesn't provide any property or method for that unfortunately.

  • Related