David, çevre değişkenlerini kullanma riski konusunda çok iyi bir noktaya işaret etti. Sadece çevre değişkenleriyle ilgili başka problemler olabileceğini de ekleyebilirim. Sadece bizim 5 yaşındaki projeden bu fiili kod parçası bakmak:
Public Function CurrentWorkbenchUser() As String
' 2004-01-05, YM: Using Application.CurrentUser for identification of
' current user is very problematic (more specifically, extremely
' cumbersome to set up and administer for all users).
' Therefore, as a quick fix, let's use the OS-level user's
' identity instead (NB: the environment variables used below must work fine
' on Windows NT/2000/2003 but may not work on Windows 98/ME)
' CurrentWorkbenchUser = Application.CurrentUser
'
' 2005-06-13, YM: Environment variables do not work in Windows 2003.
' Use Windows Scripting Host (WSH) Networking object instead.
' CurrentWorkbenchUser = Environ("UserDomain") & "\" & Environ("UserName")
'
' 2007-01-23, YM: Somewhere between 2007-01-09 and 2007-01-20,
' the WshNetwork object stopped working on CONTROLLER3.
' We could not find any easy way to fix that.
' At the same time, it turns out that environment variables
' do work on Windows 2003.
' (Apparently, it was some weird configuration problem back in 2005:
' we had only one Windows 2003 computer at that time and it was
' Will's workstation).
'
' In any case, at the time of this writing,
' returning to environment variables
' appears to be the simplest solution to the problem on CONTROLLER3.
' Dim wshn As New WshNetwork
' CurrentWorkbenchUser = wshn.UserDomain & "\" & wshn.UserName
CurrentWorkbenchUser = Environ("USERDOMAIN") & "\" & Environ("USERNAME")
End Function
Link-only cevabınızı aşağıya çekmeye ikna oldum, ama meh, sadece neyse ki çürümüş bağlantıdan alıntı yapalım;) –
Hepsi iyi. Yansıma oldukça boktan bir cevaptı. İlk günler doluydu, sadece bağlantılara bağlanma, bugün olduğu gibi, savunmamda her şey kadar katı değildi;) Her neyse, düzenleme için teşekkürler. – JamesSugrue