ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting WorkstationID (https://www.excelbanter.com/excel-programming/299614-getting-workstationid.html)

Derek[_6_]

Getting WorkstationID
 
I'm building a DSN connection on the fly in VB
NewPath = "ODBC;DSN=" & sNewDSN & ";Description=" & sNewDSN & ";UID=administrator;APP=Microsoft Office XP;WSID=ServerName;DATABASE=" & sNewDB & ";Network=DBMSSOCN;Trusted_Connection=Yes

However the application needs to be copied to several servers. Therefore I need to work out the WSID part in code, rather than hardcoding it to "Servername" as in the above example

Can anyone tell me how to do this

Thanks in advanc
Derek

mudraker[_238_]

Getting WorkstationID
 
Have a look at the Environ settings

I have only used these on NT but I beleive they also apply to othe
Window versions

Sub ddd()
Dim i
For i = 1 To 57
Debug.Print "i = " & i & " " & Environ(i)
Next
End Su

--
Message posted from http://www.ExcelForum.com


Derek[_6_]

Getting WorkstationID
 
Thanks Mudrake

It was Environ(5)

Derek

Bob Phillips[_6_]

Getting WorkstationID
 
It is better to use

environ("Computername")

then you don't get the prefix, it is more descriptive, and will work where
it is not index 5.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Derek" wrote in message
...
Thanks Mudraker

It was Environ(5).

Derek





All times are GMT +1. The time now is 07:38 PM.

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