ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can system variables be used inside Excel (https://www.excelbanter.com/excel-programming/357718-can-system-variables-used-inside-excel.html)

John F[_2_]

Can system variables be used inside Excel
 
Can the system variables like %HOMEPATH% be used inside of Excel? If so then
how?

Jim Thomlinson

Can system variables be used inside Excel
 
You can write your own User Defined Functions that you can use in Excel. For
example place this code in a standard code module

public function HomePath() as string
HomePath = thisworkbook.path
end function

In any cell type =HomePath()

You can also use environ to get system data

public function LoginName() as string
LoginName = environ("UserName")
end function
--
HTH...

Jim Thomlinson


"John F" wrote:

Can the system variables like %HOMEPATH% be used inside of Excel? If so then
how?


John F[_2_]

Can system variables be used inside Excel
 
Thanks Got it

"Jim Thomlinson" wrote:

You can write your own User Defined Functions that you can use in Excel. For
example place this code in a standard code module

public function HomePath() as string
HomePath = thisworkbook.path
end function

In any cell type =HomePath()

You can also use environ to get system data

public function LoginName() as string
LoginName = environ("UserName")
end function
--
HTH...

Jim Thomlinson


"John F" wrote:

Can the system variables like %HOMEPATH% be used inside of Excel? If so then
how?



All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com