Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Simplefi, Not that I am aware of. The only method I have seen and used is a use defined function that calls the Windows API. It is quite easy t install and use. Here are the code and the directions to install th API call and user defined function. Installation Directions... 1) Copy the code in this post using CTRL+C 2) Open the Workbook the macro will be installed in. 3) Press ALT+F11 to launch the VBA Editor. 4) Press ALT+I to activate the Insert Menu 5) Press M to insert a new VBA module into the Workbook. 6) Press CTRL+V to paste the macro code into the module. 7) Press CTRL+S to save the Workbook changes Using the Macro... Simply use the Formula below in a cell to return the computr's name. =ComputerName() Code ------------------- Declare Function GetComputerName _ Lib "kernel32" _ Alias "GetComputerNameA" _ (ByVal lpBuffer As String, _ nSize As Long) As Long Function ComputerName() As String Dim CompName As String * 256 Dim RetVal CompName = String(0, 256) RetVal = GetComputerName(CompName, 256) Chars = InStr(1, CompName, Chr$(0)) - 1 If Chars 0 Then ComputerName = Left(CompName, Chars) Else ComputerName = "" End If End Function ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=55344 |