Tecnologia, programação e muito Visual FoxPro.

domingo, 26 de setembro de 2010

Re: ]] XL-mania [[ .::: detect Computer Name dari xls dengan formula atau macro :::.

 

trimakaseh, bonusnya banyak banget...

tetapi, IMHO, coding pak edison tsb masih dapat diringkas
dengan tidak perlu menuliskan perintah Exit Function di setiap Case
karena struktur Select Case hanya akan memilih satu pilihan
(jika sudah ketemu Case yg cocok tidak lagi membaca Case lain dibawahnya)
sehingga ketika bertemu case yg cocok dan meng-assigned variable Jeneng
ostosmastis dia keluar dari struktur Select Case tanpa ferlu disuruh dgn 'ExitFunction'


' coding setelah diringkas
Function Jeneng(Optional NameType As String) As String
   Application.Volatile
   If Len(NameType) = 0 Then NameType = 1
   Select Case UCase(NameType)
      Case Is = "1"
         Jeneng = Application.UserName
      Case Is = "2"
         Jeneng = Environ("UserName")
      Case Is = "3"
         Jeneng = Environ("ComputerName")
      Case Is = "4"
         Jeneng = Environ(1)
      Case Is = "5"
         Jeneng = Environ(2)
      Case Is = "6"
         Jeneng = Environ(3)
      Case Is = "7"
         Jeneng = Environ(4)
      Case Is = "8"
         Jeneng = Environ(5)
      Case Is = "9"
         Jeneng = Environ(6)
      Case Is = "10"
         Jeneng = Environ(7)
      Case Is = "11"
         Jeneng = Environ(8)
      Case Is = "12"
         Jeneng = Environ(9)
      Case Is = "13"
         Jeneng = Environ(10)
      Case Is = "14"
         Jeneng = Environ(11)
      Case Is = "15"
         Jeneng = Environ(12)
      Case Is = "16"
         Jeneng = Environ(13)
      Case Is = "17"
         Jeneng = Environ(14)
      Case Is = "18"
         Jeneng = Environ(15)
      Case Is = "19"
         Jeneng = Environ(16)
      Case Is = "20"
         Jeneng = Environ(17)
      Case Is = "21"
         Jeneng = Environ(18)
      Case Is = "22"
         Jeneng = Environ(19)
      Case Is = "23"
         Jeneng = Environ(20)
      Case Else
         Jeneng = CVErr(xlErrValue)
   End Select
End Function




2010/9/22 edi edison <edi28881@yahoo.com>
>
> Option Explicit
> Function Jeneng(Optional NameType As String) As String
>     Application.Volatile
>     If Len(NameType) = 0 Then NameType = 1
>     Select Case UCase(NameType)
>         Case Is = "1"
>             Jeneng = Application.UserName
>             Exit Function
>         Case Is = "2"
>             Jeneng = Environ("UserName")
>             Exit Function
>         Case Is = "3"
>             Jeneng = Environ("ComputerName")
>             Exit Function
>         Case Is = "4"
>             Jeneng = Environ(1)
>             Exit Function
>         Case Is = "5"
>             Jeneng = Environ(2)
>             Exit Function
>         Case Is = "6"
>             Jeneng = Environ(3)
>             Exit Function
>         Case Is = "7"
>             Jeneng = Environ(4)
>             Exit Function
>         Case Is = "8"
>             Jeneng = Environ(5)
>             Exit Function
>         Case Is = "9"
>             Jeneng = Environ(6)
>             Exit Function
>         Case Is = "10"
>             Jeneng = Environ(7)
>             Exit Function
>         Case Is = "11"
>             Jeneng = Environ(8)
>             Exit Function
>         Case Is = "12"
>             Jeneng = Environ(9)
>             Exit Function
>         Case Is = "13"
>             Jeneng = Environ(10)
>             Exit Function
>         Case Is = "14"
>             Jeneng = Environ(11)
>             Exit Function
>         Case Is = "15"
>             Jeneng = Environ(12)
>             Exit Function
>         Case Is = "16"
>             Jeneng = Environ(13)
>             Exit Function
>         Case Is = "17"
>             Jeneng = Environ(14)
>             Exit Function
>         Case Is = "18"
>             Jeneng = Environ(15)
>             Exit Function
>         Case Is = "19"
>             Jeneng = Environ(16)
>             Exit Function
>         Case Is = "20"
>             Jeneng = Environ(17)
>             Exit Function
>         Case Is = "21"
>             Jeneng = Environ(18)
>             Exit Function
>         Case Is = "22"
>             Jeneng = Environ(19)
>             Exit Function
>         Case Is = "23"
>             Jeneng = Environ(20)
>             Exit Function
>            
>         Case Else
>             Jeneng = CVErr(xlErrValue)
>     End Select
> End Function
>  
> ________________________________
> From: "Ardo, Ronald" <ronald.ardo@siemens.com>
> To: XL-mania@yahoogroups.com
> Sent: Tuesday, September 21, 2010 15:26:04
> Subject: ]] XL-mania [[ .::: detect Computer Name dari xls dengan formula atau macro :::.
>
> Dear Pakar xls and members,
>  
> Mohon share formula atao macro untuk detect computer name tertentu ...
> Jurus ini untuk digunakan pada file yang diperbolehkan hanya untuk comuter tertentu.
>  
> Terimakasih atas pencerahanya.
>  
> Salam
> Ardo

__._,_.___
Recent Activity:
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| oppsss... thr-nya kok cepet banget ya habisnya....  T_____T       |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf          |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message,  melecehkan,  tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan  winzip  jika  perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke  |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/           |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau...  |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html           |
+-------------------------------------------------------------------+
| Message lama ada di :                                             |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id]  |
| http://www.mail-archive.com/xl-mania@yahoogroups.com              |
+-------------------------------------------------------------------+
.

__,_._,___

Nenhum comentário:

Arquivo do blog