Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Does anyone know the VBA for getting the host name of a server (Windows Server 2003) that an Excel spreadsheet (Excel 2003) is sitting on (I don't mean path info, as I already know this and the host name doesn't show up). I'm trying to set-up a trigger, so that if an Excel file is removed from the server onto someones PC the file will behave differently. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use this function to get the UNC from a file.
Pass the workbook path to the function, and just strip the UNC from the returned UNC path Function GetUNCPath(myDriveLetter As String) As String Dim lReturn As Long Dim szBuffer As String myDriveLetter = Left(myDriveLetter, 1) & ":" szBuffer = String$(256, vbNullChar) lReturn = WNetGetConnectionA(myDriveLetter, szBuffer, 256) If lReturn = 0 Then GetUNCPath = Left$(szBuffer, InStr(szBuffer, vbNullChar)) Else GetUNCPath = "Error" End If End Function -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Delboy" wrote in message ... Hi, Does anyone know the VBA for getting the host name of a server (Windows Server 2003) that an Excel spreadsheet (Excel 2003) is sitting on (I don't mean path info, as I already know this and the host name doesn't show up). I'm trying to set-up a trigger, so that if an Excel file is removed from the server onto someones PC the file will behave differently. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Which hosting is better? Hostgater or seo-host | Excel Discussion (Misc queries) | |||
Top 10 Things To Look For In A Web Host | Excel Worksheet Functions | |||
Host Session Emulation | Excel Worksheet Functions | |||
host hospedagem profissional por 2,99 ao mês | Charts and Charting in Excel | |||
Convert IP Address to Host Name | Excel Programming |